Ok so I have a script in ServerScriptService which handles billboardgui titles above the player's heads:

local bbg = script.BillboardGui
local bbg2 = script.PlayerTitle

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		if player.Name == "PLAYER1" then	
			if character.Head:FindFirstChild("BillboardGui") then
				print("Player already has title!")
			else				
				local clonedgui = bbg:Clone()
				clonedgui.TextLabel.Text = "Game Manager"
				clonedgui.TextLabel.TextColor3 = Color3.new(1,1,1)
				clonedgui.TextLabel.dynamicRainbow.Disabled = false
				clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
			end
		elseif player.Name == "PLAYER2" then
			if character.Head:FindFirstChild("BillboardGui") then
				print("Player already has title!")
			else				
				local clonedgui = bbg:Clone()
				clonedgui.TextLabel.Text = "TITLE2"
				clonedgui.TextLabel.TextColor3 = Color3.new(1,1,1)
				clonedgui.TextLabel.dynamicRainbow.Disabled = false
				clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head	
			end
		else
			local clonedgui = bbg2:Clone()
			clonedgui.TextLabel.Text = ""
			clonedgui.TextLabel.TextColor3 = Color3.new(255,255,255)
			clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		end
	end)
end)

function titlecheck(player, character)
	local clonedgui = game.Workspace:WaitForChild(player.Name).Head.BillboardGui
	if player:WaitForChild("leaderstats").Quacks.Value <= 100 then
		clonedgui.TextLabel.Text = "Beginner Quacker"
		clonedgui.TextLabel.TextColor3 = Color3.new(255,255,255)
	elseif player:WaitForChild("leaderstats").Quacks.Value <= 500 then
		clonedgui.TextLabel.Text = "Learning Quacker"
		clonedgui.TextLabel.TextColor3 = Color3.new(255,255,255)
	end
end

while wait(5) do
	local player = game.Players.PlayerAdded
	local character = player.CharacterAdded
	titlecheck(player, character)
end

This is what the script is like: https://imgur.com/gUm3VIo

What this script does is check if the game manager or owner joined then if so give them a special title that can't be overridden. Otherwise, give player their normal title with a function to update every 5 seconds. I know using playername isn't safe but it's an example. Now, I'm not sure what happened as there are no error in outputs but now this script doesn't give titles? Please tell me what's going wrong with it. Thanks.

1 comment

0

From what I see, are you testing it by just hitting play, or starting a server. Since when you use player1 and player2, you only gets those names by starting up a test server in studio