My overhead GUI is not showing up

I made a overhead GUI.

It’s a GUI thats over the players head.

The code use to work before I put the elseif statements. Maybe I did it wrong?

Heres the code.

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local GuiClone = script.OverheadGui:Clone()
		GuiClone.Parent = Character.Head

		local InformationLabel = GuiClone.InformationLabel

		if Player.leaderstats.Wins.Value >= 100 then
			InformationLabel.TextColor3 = Color3.new(0.87451, 0, 0)
			InformationLabel.Text = Player.DisplayName .. " - GOAT"
		elseif Player.leaderstats.Wins.Value >= 75 then
			InformationLabel.TextColor3 = Color3.new(0.552941, 0, 0.831373)
			InformationLabel.Text = Player.DisplayName .. " - Pro"
		elseif Player.leaderstats.Wins.Value >= 60 then
			InformationLabel.TextColor3 = Color3.new(0.552941, 0, 0.831373)
			InformationLabel.Text = Player.DisplayName .. " - Insane"
		elseif Player.leaderstats.Wins.Value >= 50 then
			InformationLabel.TextColor3 = Color3.new(0.552941, 0, 0.831373)
			InformationLabel.Text = Player.DisplayName .. " - Elite"
		elseif Player.leaderstats.Wins.Value >= 35 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 1)
			InformationLabel.Text = Player.DisplayName .. " - Incredibe"
		elseif Player.leaderstats.Wins.Value >= 25 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 1)
			InformationLabel.Text = Player.DisplayName .. " - Awesome"
		elseif Player.leaderstats.Wins.Value >= 10 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 1)
			InformationLabel.Text = Player.DisplayName .. " - Amazing"
		elseif Player.leaderstats.Wins.Value >= 5 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 0)
			InformationLabel.Text = Player.DisplayName .. " - Meh"
		elseif Player.leaderstats.Wins.Value >= 0 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 0)
			InformationLabel.Text = Player.DisplayName .. " - Beginner"
		else
			print("Something Wrong Happened")
			
			
		end
	end)
end)

There’s no overhead GUI over your head.
The else print does not print either.
No errors.

My leaderstats in 6 win btw.

2 Likes

Send a picture of the overhead gui in the explorer please!

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local GuiClone = script.OverheadGui:Clone()
		GuiClone.Parent = Character:WaitForChild("Head")
                GuiClone.Adornee = Character.Head

		local InformationLabel = GuiClone.InformationLabel

		if Player.leaderstats.Wins.Value >= 100 then
			InformationLabel.TextColor3 = Color3.new(0.87451, 0, 0)
			InformationLabel.Text = Player.DisplayName .. " - GOAT"
		elseif Player.leaderstats.Wins.Value >= 75 then
			InformationLabel.TextColor3 = Color3.new(0.552941, 0, 0.831373)
			InformationLabel.Text = Player.DisplayName .. " - Pro"
		elseif Player.leaderstats.Wins.Value >= 60 then
			InformationLabel.TextColor3 = Color3.new(0.552941, 0, 0.831373)
			InformationLabel.Text = Player.DisplayName .. " - Insane"
		elseif Player.leaderstats.Wins.Value >= 50 then
			InformationLabel.TextColor3 = Color3.new(0.552941, 0, 0.831373)
			InformationLabel.Text = Player.DisplayName .. " - Elite"
		elseif Player.leaderstats.Wins.Value >= 35 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 1)
			InformationLabel.Text = Player.DisplayName .. " - Incredibe"
		elseif Player.leaderstats.Wins.Value >= 25 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 1)
			InformationLabel.Text = Player.DisplayName .. " - Awesome"
		elseif Player.leaderstats.Wins.Value >= 10 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 1)
			InformationLabel.Text = Player.DisplayName .. " - Amazing"
		elseif Player.leaderstats.Wins.Value >= 5 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 0)
			InformationLabel.Text = Player.DisplayName .. " - Meh"
		elseif Player.leaderstats.Wins.Value >= 0 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 0)
			InformationLabel.Text = Player.DisplayName .. " - Beginner"
		else
			print("Something Wrong Happened")
			
			
		end
	end)
end)

Error9

1 Like

I’d advise not making the GUI a child of the head when cloned, rather make it a child of the players StarterGUI and set the BillboardGUI’s Adornee (a property of billboardgui’s) to the player’s head.

1 Like

The thing is the code worked before.

Until I made the elsesif statments.

Did I maybe misspell something?

This is a big mess, tbh.
Improved code:

game:GetService("Players").PlayerAdded:Connect(function(p)
	p.CharacterAdded:Connect(function(c)
		if c:FindFirstChild("Head") then
				local a = script.Team:Clone()
					a.PlayerName.Text = p.Name
					a.Ranks.Text = --this is the text that displays under the name
					a.PlayerName.TextColor3 = p.TeamColor.Color
					a.Ranks.TextColor3 = p.TeamColor.Color
					a.StudsOffset = Vector3.new(0,c.Head.Size.Y+0.6,0)
					a.Parent = c.Head
				end
			end)
		end)

Hope this helps! :slight_smile:
Does not include your table, just a basic nametag

Let me upload this as a model, actually, so you get the stuff.

This would be your output:
image
https://www.roblox.com/library/6891019419/e

1 Like
local values = {
	[0] = "Beginner", --[wins] = "title"
	[10] = "Meh",
	[25] = "Awesome"
	--so on
}
local function updateWins(plr) --so you can update it anytime, not only when they reset
	local value = plr:WaitForChild("leaderstats").Wins.Value
	local label = game.Workspace:WaitForChild(plr.Name).Head.OverheadGui.InformationLabel
    --character was frustrating to get so I implemented this long line instead (works the same anyhow).
	for wins, title in pairs(values) do --for each value, title in pairs
		if wins > value then --if more wins than value then
			return --forget about it, don't override the title
		end
		label.Text = plr.DisplayName.." - "..title --title
        --if you want to customise their colour or whatever:
       if title == "Amazing" then
           print("special features here")
       end
	end
end

game.Players.PlayerAdded:Connect(function(plr)
    --[ used for testing ]
	local lds = Instance.new("Folder")
	lds.Name = "leaderstats"
	lds.Parent = plr
	local val = Instance.new("IntValue")
	val.Name = "Wins"; val.Value = 26
	val.Parent = lds
    --[ used for testing ]
	plr.CharacterAdded:Connect(function(char)
		local clone = game:GetService("ReplicatedStorage").OverheadGui:Clone()

		clone.StudsOffset = Vector3.new(0, char.Head.Size.Y + 0.6, 0) --optional. credits to DarkPixlz
		clone.Parent = game.Workspace:WaitForChild(plr.Name).Head --character was being stubborn once again
		updateWins(plr) --we can finally update their label
	end)
end)
3 Likes

I used your script and edited it

local values = {
	[0] = "Beginner", --[wins] = "title"
	[5] = "Meh",
	[10] = "Amazing",
	[25] = "Awesome",
	[35] = "Incredibe",
	[50] = "Elite",
	[60] = "Insane",
	[75] = "Pro",
	[100] = "GOAT"
	
	--so on
}
local function updateWins(plr) --so you can update it anytime, not only when they reset
	local value = plr:WaitForChild("leaderstats").Wins.Value
	local label = game.Workspace:WaitForChild(plr.Name).Head.OverheadGui.InformationLabel
	--character was frustrating to get so I implemented this long line instead (works the same anyhow).
	for wins, title in pairs(values) do --for each value, title in pairs
		if wins > value then --if more wins than value then
			return --forget about it, don't override the title
		end
		label.Text = plr.DisplayName.." - "..title --title
		--if you want to customise their colour or whatever:
		if title == "Beginner" or "Meh" then
			label.TextColor3 = Color3.new(0, 0, 0)
		elseif title == "Amazing" or "Awesome" then
			label.TextColor3 = Color3.new(0, 0, 1)
		elseif title == "Incredible" or "Elite" or "Insane" or "Pro" then
			label.TextColor3 = Color3.new(0.8, 0.266667, 0.8)
		elseif title == "GOAT" then
			label.TextColor3 = Color3.new(0.862745, 0, 0)
		end
	end
end

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

	plr.CharacterAdded:Connect(function(char)
		local clone = game:GetService("ReplicatedStorage").OverheadGui:Clone()

		clone.StudsOffset = Vector3.new(0, char.Head.Size.Y + 0.1, 0) --optional. credits to DarkPixlz
		clone.Parent = game.Workspace:WaitForChild(plr.Name).Head --character was being stubborn once again
		updateWins(plr) --we can finally update their label
	end)
end)

--- 0 Beginner
--- 5 Meh
--- 10 Amazing
----25 Awesome
--- 35 Incredibe
--- 50 Elite
--- 60 Insane
--- 75 Pro
--- 100 GOAT

I am at 7 wins and it stays at Beginner.

(No errors)

1 Like

Did you try mine?

Yeah!

Don’t understand it lol.

This one I do a bit

1 Like

Could be that it returns before comparing lower levels - use continue instead.

		if wins > value then
			continue --replaced with "return"
		end

Hold on.

1 Like

It changes the text now.

Not the color.

It stays on black now…

Alright - after an hour of researching upon figuring out how table.sort()s work, properly, I’ve came up with this:

local values = {
	[1] = {"Beginner", 0}, --[pos] = {title, wins}
	[2] = {"Meh", 5},
	[3] = {"Amazing", 10},
	[4] = {"Awesome", 25},
	[5] = {"Incredible", 35},
	[6] = {"Elite", 50},
	[7] = {"Insane", 60},
	[8] = {"Pro", 75},
	[9] = {"GOAT", 100}
	--so on
}
table.sort(values, function(a, b) --sorting out tables (Roblox apparently didn't sort them about by default)
	return a[2] < b[2]
end)

local function updateWins(plr) --so you can update it anytime, not only when they reset
	local value = plr:WaitForChild("leaderstats").Wins.Value
	local label = game.Workspace:WaitForChild(plr.Name).Head.OverheadGui.InformationLabel
	--character was frustrating to get so I implemented this long line instead (works the same anyhow).
	for _, val in ipairs(values) do --for each value, title in pairs
		local title = val[1]; local wins = val[2]
		if wins > value then --if more wins than value then
			continue --forget about it, don't override the title
		end
		label.Text = plr.DisplayName.." - "..title --title
		--if you want to customise their colour or whatever:
		if title == "Beginner" or title == "Meh" then
			label.TextColor3 = Color3.fromRGB(0, 10, 0) --changes colour from RGB
		elseif title == "Amazing" or title == "Awesome" then
			label.TextColor3 = Color3.fromRGB(0, 10, 0)
		elseif title == "Incredible" or title == "Elite" or title == "Insane" or title == "Pro" then
			label.TextColor3 = Color3.fromRGB(0, 10, 0)
		elseif title == "GOAT" then
			label.TextColor3 = Color3.fromRGB(255, 10, 0)
		end
	end
end

game.Players.PlayerAdded:Connect(function(plr)
	--[ used for testing ]
	local lds = Instance.new("Folder")
	lds.Name = "leaderstats"
	lds.Parent = plr
	local val = Instance.new("IntValue")
	val.Name = "Wins"; val.Value = 101
	val.Parent = lds
	--[ used for testing ]
	plr.CharacterAdded:Connect(function(char)
		local clone = game:GetService("ReplicatedStorage").OverheadGui:Clone()

		clone.StudsOffset = Vector3.new(0, char.Head.Size.Y + 0.1, 0) --optional. credits to DarkPixlz
		clone.Parent = game.Workspace:WaitForChild(plr.Name).Head --character was being stubborn once again
		updateWins(plr) --we can finally update their label
	end)
end)

The issue you had with changing colour is or statements - as you didn’t mention title, therefore, leaving it as a string:

local title = "string"
if title == "number" or title == "string" then --always include the reference
    print("title has been found!")
end

I’d also advise to utilise Color3.fromRGB() as it’s easier, and you can get it from Roblox’s normal pallete for changing colours - rather than converting it into different values.

Hello, it seems like roblox studio had an update which messed everyone’s overhead. I actually found a solution to fix this new update thats bugging the overhead.

u can put wait() before u clone the overhead!
like this:

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local GuiClone = script.OverheadGui:Clone()
		GuiClone.Parent = Character.Head

		local InformationLabel = GuiClone.InformationLabel
wait()
		if Player.leaderstats.Wins.Value >= 100 then
			InformationLabel.TextColor3 = Color3.new(0.87451, 0, 0)
			InformationLabel.Text = Player.DisplayName .. " - GOAT"
		elseif Player.leaderstats.Wins.Value >= 75 then
			InformationLabel.TextColor3 = Color3.new(0.552941, 0, 0.831373)
			InformationLabel.Text = Player.DisplayName .. " - Pro"
		elseif Player.leaderstats.Wins.Value >= 60 then
			InformationLabel.TextColor3 = Color3.new(0.552941, 0, 0.831373)
			InformationLabel.Text = Player.DisplayName .. " - Insane"
		elseif Player.leaderstats.Wins.Value >= 50 then
			InformationLabel.TextColor3 = Color3.new(0.552941, 0, 0.831373)
			InformationLabel.Text = Player.DisplayName .. " - Elite"
		elseif Player.leaderstats.Wins.Value >= 35 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 1)
			InformationLabel.Text = Player.DisplayName .. " - Incredibe"
		elseif Player.leaderstats.Wins.Value >= 25 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 1)
			InformationLabel.Text = Player.DisplayName .. " - Awesome"
		elseif Player.leaderstats.Wins.Value >= 10 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 1)
			InformationLabel.Text = Player.DisplayName .. " - Amazing"
		elseif Player.leaderstats.Wins.Value >= 5 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 0)
			InformationLabel.Text = Player.DisplayName .. " - Meh"
		elseif Player.leaderstats.Wins.Value >= 0 then
			InformationLabel.TextColor3 = Color3.new(0, 0, 0)
			InformationLabel.Text = Player.DisplayName .. " - Beginner"
		else
			print("Something Wrong Happened")
			
			
		end
	end)
end)
1 Like

btw, if it worked for u, make sure to mark it as a solution.

It didn’t.

I already found the solution and marked it…

Oh lol I didn’t notice. I think its because I didn’t place it at the right place, U probably have to place it before u clone each time but that’d probably glitch so i’m not sure

1 Like

I am having that EXACT SAME issue in multiple games that use my overhead Uis

1 Like