Problems with OverheadGui

Hello Developers. Recently, I made an Interview Center for myself, not a group, and tried adding an OverheadGui on characters. A friend recommended me a script, which I reviewed of course, he also used it on at his place. But it somehow doesn’t work me, on 2 of my places. When another friend of mine joins, they get an Overhead unlike me. Which is kinda weird to me. I have seen some global unknowns which I’ve fixed already. I tried putting the script in a showcase, and it still didn’t work. Why is it only me, who doesn’t get the OverheadGui above my head?

Script:

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

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

player.CharacterAdded:Connect(function(character)

	if player.UserId  == 179630308 then
		local clonedgui = billboardgui:Clone()
		clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		clonedgui.TextLabel.Text = "Crashstyler747 | Owner"
		clonedgui.TextLabel.TextColor3 = Color3.fromRGB(255,255,0)
		
	end
	
	
	if player.UserId == 149953103 then
		local clonedgui = billboardgui:Clone()
		clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		clonedgui.TextLabel.Text = "Swaggyist | Co-Owner"
		clonedgui.TextLabel.TextColor3 = Color3.fromRGB(255,255,0)
		
	end
	
	if player.UserId == 103100262 then
		local clonedgui = billboardgui:Clone()
		clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		clonedgui.TextLabel.Text = "Le_Waffles | Head Supervisor"
		clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0, 0, 255)
		
	end
	
	if player.UserId == 150389464 then
		local clonedgui = billboardgui:Clone()
		clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		clonedgui.TextLabel.Text = "Kodinx | Head Supervisor"
		clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0, 0, 255)
		
	end
	
	if player.UserId == 88316593 then
		local clonedgui = billboardgui:Clone()
		clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		clonedgui.TextLabel.Text = "tige1111 | Head Supervisor"
		clonedgui.TextLabel.TextColor3 = Color3.fromRGB(0, 0, 255)
		
	end
	
	-- All special titles
	
	if character.Head:FindFirstChild("BillboardGui") then
		
	else
		if player:IsInGroup(4125860) then
			local clonedgui = billboardgui:Clone()
			clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
			clonedgui.TextLabel.Text = "Member"
			clonedgui.TextLabel.TextColor3 = Color3.fromRGB(14, 14, 14)
			
		end
	end
	
	
	--Group member title
	
	if character.Head:FindFirstChild("BillboardGui") then
		
	else
		local clonedgui = billboardgui:Clone()
		clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		clonedgui.TextLabel.Text = "Visitor"
		clonedgui.TextLabel.TextColor3 = Color3.fromRGB(247, 247, 247)
		
	end
	
	--All others
	
end)

end)

Hello.
You should use else if. I made an Overhead GUI for you.
I used a ModuleScript to keep the main script clean.

local Users = {
	[250841454] = "JakyeRU | Hmm",
	[149953103] = "Swaggyist | Co-Owner",
	[179630308] = "Crashstyler747 | Owner",
	[103100262] = "Le_Waffles | Head Supervisor",
	[150389464] = "Kodinx | Head Supervisor",
	[88316593] = "tige1111 | Head Supervisor",
}

return Users
local Users = require(script.PlayerList)

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function()
		if Users[player.UserId] then
			local GUI = script.Overhead:Clone()
			GUI.Frame.Label.Text = Users[player.UserId]
			GUI.Frame.Label.TextColor3 = Color3.fromRGB(255,255,0)
			GUI.Parent = game.Workspace:WaitForChild(player.Name):FindFirstChild("Head")
		elseif
			player:IsInGroup(4125860) then
				local GUI = script.Overhead:Clone()
				GUI.Frame.Label.Text = "Member | "..player.Name
				GUI.Frame.Label.TextColor3 = Color3.fromRGB(14,14,14)
				GUI.Parent = game.Workspace:WaitForChild(player.Name):FindFirstChild("Head")
		else
			local GUI = script.Overhead:Clone()
			GUI.Frame.Label.Text = "Visitor | "..player.Name
			GUI.Frame.Label.TextColor3 = Color3.fromRGB(247,247,247)
			GUI.Parent = game.Workspace:WaitForChild(player.Name):FindFirstChild("Head")
		end
	end)
end)

Here is the file: Overhead GUI.rbxm (5.1 KB)

2 Likes

Hello, I think your script has an local error.


Make a Script and insert a Module Script in it. Name the Module Script PlayerList.

-- MODULE SCRIPT CODE
local Users = {
	[250841454] = "JakyeRU | Hmm",
	[149953103] = "Swaggyist | Co-Owner",
	[179630308] = "Crashstyler747 | Owner",
	[103100262] = "Le_Waffles | Head Supervisor",
	[150389464] = "Kodinx | Head Supervisor",
	[88316593] = "tige1111 | Head Supervisor",
}

return Users
-- NORMAL SCRIPT CODE
local Users = require(script.PlayerList)

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function()
		if Users[player.UserId] then
			local GUI = script.Overhead:Clone()
			GUI.Frame.Label.Text = Users[player.UserId]
			GUI.Frame.Label.TextColor3 = Color3.fromRGB(255,255,0)
			GUI.Parent = game.Workspace:WaitForChild(player.Name):FindFirstChild("Head")
		elseif
			player:IsInGroup(4125860) then
				local GUI = script.Overhead:Clone()
				GUI.Frame.Label.Text = "Member | "..player.Name
				GUI.Frame.Label.TextColor3 = Color3.fromRGB(14,14,14)
				GUI.Parent = game.Workspace:WaitForChild(player.Name):FindFirstChild("Head")
		else
			local GUI = script.Overhead:Clone()
			GUI.Frame.Label.Text = "Visitor | "..player.Name
			GUI.Frame.Label.TextColor3 = Color3.fromRGB(247,247,247)
			GUI.Parent = game.Workspace:WaitForChild(player.Name):FindFirstChild("Head")
		end
	end)
end)

If you can’t firgure it out use this:
Overhead GUI.rbxm (5.1 KB)
Right click on ServerScriptService > Insert from file then select Overhead GUI.rbxm.

I tried to do it without download and then I downloaded it, well I’ll try it with a friend or a random person to check if your OverheadGui works for them, because it doesn’t work for me. IT’s strange that it only doesn’t work for me.

Please review:

You have to follow the format given there. Please do not just ask “this script is broken, how do I fix it?” if you haven’t written the script to begin with. This is for scripting support, i.e. to help you learn how to fix the code, not just fixing the code in itself.