Script error confused

Whats wrong?

local leaderstats = game.Players.LocalPlayer:WaitForChild("leaderstats")

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local GuiClone = script.OverheadGui:Clone()
		GuiClone.Parent = Character.Head
		
		local PlayerRank = leaderstats:WaitForChild("Rank")
		local PlayerName = script.Name
		
		PlayerName.Text = Player.Name .. "-" PlayerRank.Value
	end)
end)

Is this a server script or a local script?

Its a script with a billbgui in it

Hello! When asking for support, error messages are incredibly helpful.
Specifying whether the script is a server or client script is also helpful. Even better, where the script is.

This part is the error where it started

When you say “Whats wrong?” Please also provide an error, that will help with anybody looking to help you

I don’t have an error to go off of, but it looks like you’re issue is that you’re indexing Character.Head when it doesn’t exist yet, so try doing this:

GuiClone.Parent = Character:WaitForChild("Head")

You also missed a .. concat operator here: "-" PlayerRank.Value
So do this:

PlayerName.Text = Player.Name .. "-" .. PlayerRank.Value

Also, because LocalPlayer already exists when you join, that means .PlayerAdded will never fire for the local player. Instead, you can refactor this a little bit, like this:

local Leaderstats = game.Players.LocalPlayer:WaitForChild("leaderstats")

local function Added(Player)
    Player.CharacterAdded:Connect(function(Character)
		local GuiClone = script:WaitForChild("OverheadGui"):Clone()
		GuiClone.Parent = Character:WaitForChild("Head")
		
		local PlayerRank = leaderstats:WaitForChild("Rank")
		local PlayerName = script.Name -- setting `.Text` does nothing here?
		
		PlayerName.Text = Player.Name .. "-" .. PlayerRank.Value 
	end)
end

task.spawn(Added, game:GetService("Players").LocalPlayer)

game.Players.PlayerAdded:Connect(Added)