I've been trying to put a GUI above a player's head that says his/her rank according to a script. This is the part of the script that assigns the ranks:
01 | rank.Name = "Rank" |
02 | rank.Parent = leaderstats |
03 | if newPlayer.Name = = "DevSupremecy" then |
04 | rank.Value = "Chief Developer" |
05 | texta.Text = ( "Chief Developer" ) |
06 | elseif newPlayer.Name = = "Dev_Noobity" then |
07 | rank.Value = "Game Owner" |
08 | texta.Text( "Game Owner" ) |
09 | elseif newPlayer.Name = = "CordeliaImperius" then |
10 | rank.Value = "Head of Administration" |
11 | texta.Text = "Head of Administration" ) |
12 | elseif newPlayer.Name = "Bigreddino556" or "XavierVernalls" then |
13 | rank.Value = "Developer" |
14 | texta.Text = ( "Developer" ) |
15 | elseif newPlayer.Name = "Player1" |
And this is the part of the script that sets up the GUI:
01 | local gui = Instance.new( "BillboardGui" ) |
02 | gui.Parent = newPlayer.Character.Head |
03 | gui.Adornee = newPlayer.Character.Head |
04 | gui.Size = UDim 2. new( 2 , 0 ,. 78 , 0 ) |
05 | gui.StudsOffset = Vector 3. new( 0 , 2 , 0 ) |
06 | local texta = Instance.new( "TextBox" ) |
07 | texta.Size = UDim 2. new( 1 , 0 , 1 , 0 ) |
08 | texta.BackgroundTransparency = 1 |
09 | texta.BackgroundColor 3 = Color 3. new( 0 , 0 , 0 ) |
10 | texta.BorderColor 3 = Color 3. new( 0 , 0 , 0 ) |
11 | texta.TextColor 3 = Color 3. new( 1 , 1 , 1 ) |
12 | texta.BorderSizePixel = 1 |
13 | texta.TextScaled = false |
14 | texta.TextStrokeTransparency = 1 |
15 | texta.FontSize = Enum.FontSize.Size 18 |
16 | texta.Parent = gui |
17 | wait( 5 ) |
Is there something wrong with the IF-ELSEIF-ELSE statements?
groupid = Put the group id here
game.Players.PlayerAdded:connect(onPlayerRespawned) function onPlayerRespawned(newPlayer) wait(1) if newPlayer:IsInGroup(groupid) then local gui = Instance.new("BillboardGui") gui.Parent=newPlayer.Character.Head gui.Adornee=newPlayer.Character.Head gui.Size=UDim2.new(2,0,.78,0) gui.StudsOffset=Vector3.new(0,2,0) local texta=Instance.new("TextBox") texta.Size=UDim2.new(1,0,1,0) texta.BackgroundTransparency = 1 texta.BackgroundColor3 = Color3.new(0, 0, 0) texta.BorderColor3 = Color3.new(0, 0, 0) texta.TextColor3 = Color3.new(1, 1, 1) texta.BorderSizePixel = 1 texta.TextScaled = false texta.TextStrokeTransparency = 1 texta.FontSize = Enum.FontSize.Size18 texta.Text = ("- " .. newPlayer:GetRoleInGroup(groupid) .. " -") texta.Parent=gui wait(5) if newPlayer:IsInGroup(1) then texta.TextColor3 = Color3.new(0, 0, 1) texta.Text = ("- MP/" .. newPlayer:GetRoleInGroup(groupid) .. " -") w = game.Lighting.WepsGroup:GetChildren() for i = 1,#w do w[i]:Clone().Parent = newPlayer.Backpack end end end end
function onPlayerEntered(newPlayer) newPlayer.Changed:connect(function (property) if (property == "Character") then onPlayerRespawned(newPlayer) end end) end
game.Players.PlayerAdded:connect(onPlayerEntered)