Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I put a Text GUI above the Player's head?

Asked by 8 years ago

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:

01rank.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"
View all 21 lines...

And this is the part of the script that sets up the GUI:

01local gui = Instance.new("BillboardGui")
02   gui.Parent=newPlayer.Character.Head
03   gui.Adornee=newPlayer.Character.Head
04   gui.Size=UDim2.new(2,0,.78,0)
05   gui.StudsOffset=Vector3.new(0,2,0)
06   local texta=Instance.new("TextBox")
07   texta.Size=UDim2.new(1,0,1,0)
08   texta.BackgroundTransparency = 1
09   texta.BackgroundColor3 = Color3.new(0, 0, 0)
10   texta.BorderColor3 = Color3.new(0, 0, 0)
11   texta.TextColor3 = Color3.new(1, 1, 1)
12   texta.BorderSizePixel = 1
13   texta.TextScaled = false
14   texta.TextStrokeTransparency = 1
15   texta.FontSize = Enum.FontSize.Size18
16   texta.Parent=gui
17   wait(5)

Is there something wrong with the IF-ELSEIF-ELSE statements?

1 answer

Log in to vote
0
Answered by 8 years ago

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)

0
No, we don't have a group yet. That's why I need the IF-ELSEIF-ELSE statements. DevSupremecy 10 — 8y
0
O Well I thought you had it use that if you have a group. MrZombieMarine 0 — 8y
0
Well, now we have the group! Thanks for the Answer! DevSupremecy 10 — 8y
Ad

Answer this question