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 7 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:

     rank.Name = "Rank"
     rank.Parent = leaderstats
     if newPlayer.Name == "DevSupremecy" then
        rank.Value = "Chief Developer"
        texta.Text = ("Chief Developer")
     elseif newPlayer.Name == "Dev_Noobity" then
        rank.Value = "Game Owner"
        texta.Text("Game Owner")
     elseif newPlayer.Name == "CordeliaImperius" then
        rank.Value = "Head of Administration"
        texta.Text = "Head of Administration")
     elseif newPlayer.Name = "Bigreddino556" or "XavierVernalls" then
        rank.Value = "Developer"
        texta.Text = ("Developer")
     elseif newPlayer.Name = "Player1"
        rank.Value = ("Studio")
        texta.Text = ("Studio")
     else
        rank.Value = "Guest"
        texta.Text = ("Guest")              
    end

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

     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.Parent=gui
        wait(5)

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

1 answer

Log in to vote
0
Answered by 7 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 — 7y
0
O Well I thought you had it use that if you have a group. MrZombieMarine 0 — 7y
0
Well, now we have the group! Thanks for the Answer! DevSupremecy 10 — 7y
Ad

Answer this question