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

Overhead Gui ranks mixed, what to do?

Asked by 4 years ago

Alright, I realized I wanted EVERYONE that joines the game to have rank above their head, not only the staff. So I did it, but when I clicked play, it mixed 2 ranks: Member (for everyone) and Management Team (for now only me) and I was wondering what could be the reason, I didn't found any mistake, it doesn't show any problems in the output, help me please.

The script:

local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")

game.Players.PlayerAdded:Connect(function(player)

    player.CharacterAdded:Connect(function(character)

        local clonedgui = billboardgui:Clone()
        clonedgui.TextLabel.Text = "Member"
        clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0,0,0)
        clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head        

    if player.Name == "lmao1717" then
            local clonedgui = billboardgui:Clone()
            clonedgui.TextLabel.Text = "Management Team"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(85,0,0)
            clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
    if player.Name == "EthonKain" then
            local clonedgui = billboardgui:Clone()
            clonedgui.TextLabel.Text = "Director"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(255,170,0)
            clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
    if player.Name == "Kaideekat13" then
            local clonedgui = billboardgui:Clone()
            clonedgui.TextLabel.Text = "Developer"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(85,170,127)
            clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
        end
        end
        end


    end)

end)

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")

game.Players.PlayerAdded:Connect(function(player)

    player.CharacterAdded:Connect(function(character)





      ---------
local clonedgui = billboardgui:Clone()
 clonedgui.TextLabel.Text = "Member"
clonedgui.Name = "OverheadGui"
clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0,0,0)
clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head     
-------------------------------




--------------------------------
    if player.Name == "lmao1717" then
            local clonedgui = game.Workspace:WaitForChild(player.Name).Head:WaitForChild("OverheadGui")  --You already cloned it into the player , now you just need to find it

            clonedgui.TextLabel.Text = "Management Team"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(85,0,0)
         --   clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
----------------------------------------

-----------------------------------------
    elseif player.Name == "EthonKain" then
            local clonedgui = game.Workspace:WaitForChild(player.Name).Head:WaitForChild("OverheadGui")
            clonedgui.TextLabel.Text = "Director"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(255,170,0)
            clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
------------------------------
    elseif player.Name == "Kaideekat13" then
             local clonedgui = game.Workspace:WaitForChild(player.Name).Head:WaitForChild("OverheadGui")
            clonedgui.TextLabel.Text = "Developer"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(85,170,127)
            clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head

        end




    end)

end)

sry for my bad english.

 local clonedgui = game.Workspace:WaitForChild(player.Name).Head:WaitForChild("OverheadGui")

Why?

Because you already cloned the Gui into the Player:

local clonedgui = billboardgui:Clone()
 clonedgui.TextLabel.Text = "Member"
clonedgui.Name = "OverheadGui"
clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0,0,0)
clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head     

AND

I changed this line of code:

  if player.Name == "lmao1717" then
            local clonedgui = billboardgui:Clone()
            clonedgui.TextLabel.Text = "Management Team"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(85,0,0)
            clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
    if player.Name == "EthonKain" then
            local clonedgui = billboardgui:Clone()
            clonedgui.TextLabel.Text = "Director"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(255,170,0)
            clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
    if player.Name == "Kaideekat13" then
            local clonedgui = billboardgui:Clone()
            clonedgui.TextLabel.Text = "Developer"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(85,170,127)
            clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
        end
        end
        end

To this code:


    if player.Name == "lmao1717" then
 local clonedgui = game.Workspace:WaitForChild(player.Name).Head:WaitForChild("OverheadGui")  --You already cloned it into the player , now you just need to find it

            clonedgui.TextLabel.Text = "Management Team"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(85,0,0)
         --   clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
----------------------------------------

-----------------------------------------
    elseif player.Name == "EthonKain" then
            local clonedgui = game.Workspace:WaitForChild(player.Name).Head:WaitForChild("OverheadGui")
            clonedgui.TextLabel.Text = "Director"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(255,170,0)
            clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
------------------------------
    elseif player.Name == "Kaideekat13" then
             local clonedgui = game.Workspace:WaitForChild(player.Name).Head:WaitForChild("OverheadGui")
            clonedgui.TextLabel.Text = "Developer"
            clonedgui.TextLabel.TextColor3 = Color3.fromRGB(85,170,127)
            clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head

        end

I changed the if to elseif

.You made a misstake :

  if player.Name == "lmao1717" then

    if player.Name == "EthonKain" then

     if player.Name == "Kaideekat13" then

        end
        end
        end

if you do it that way , the Overhead gui for the other players (Ethon and Kaidee) wont show

If you still have questions just comment :D

Have a good day

Ad

Answer this question