Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Overhead Gui ranks mixed, what to do?

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.