본문 바로가기

Roblox Script

#10 : 플레이어 머리에 이름 표시 - Player Title (Team / Role) BillboardGui

BillboardGui를 이용하여 Player에 역할이나 팀을 표시하는 script 입니다. 
script 아래 BillboardGui를 추가하고 아래 TaxtLabel를 추가한뒤 

1. 팀이름과 Font 색을 정해주는 script를 짜고
2. BillboardGui 높이를 설정하고
3. TaxtLabel을 꾸며줍니다

======

local billboard = script.BillboardGui

local textPolice = "Police"
local blueColor = Color3.fromRGB(0,0,255)

local textTheif = "Theif" 
local redColor = Color3.fromRGB(255,0,0)

game.Players.PlayerAdded:Connect(function(player)  
    player.CharacterAdded:Connect(function(char)
          local playerCount = #game.Players:GetPlayers()
          
print ("player Count is  : "..playerCount)
          
local newgui = billboard:Clone()
          
newgui.Parent = char.Head

          
if playerCount%2 == 1 then
         
     newgui.TextLabel.TextColor3 = redColor
           
   newgui.TextLabel.Text = textTheif
          
else
               
newgui.TextLabel.TextColor3 = blueColor
               
newgui.TextLabel.Text = textPolice
          
end
   end)
end)