Script not working

I’m in the process of creating an overhead-gui aswell as many other things; but I just want to highlight the overhead-gui as it doesn’t appear to be working no matter the different methods I try. I am unaware of anything that could cause this issue. Here is my script for reference.

Players.PlayerAdded:Connect(function(Player)
	local PlayerRole = Player:GetRoleInGroup(ServerGroupID)
	local PlayerRank = Player:GetRankInGroup(ServerGroupID)
	local function OnCharacterAdded(Character)
		local Head = Character:WaitForChild("Head")
		local Humanoid = Character:WaitForChild("Humanoid")
		
		local OverHeadRanks = BaseStorage.Ranks:Clone()
		OverHeadRanks.Parent = Head
		OverHeadRanks.Adornee = Head
		OverHeadRanks.Holder.Player.Text = Player.Name
		OverHeadRanks.Holder.Rank.Text = PlayerRole
	end
	
	Player.CharacterAdded:Connect(function(Character)
		OnCharacterAdded(Character)
	end)
end)

I should also point out I don’t get any outputs.

Does resetting after a few seconds or more make it work? GetRoleInGroup and GetRankInGroup both yield, meaning you are not connecting to CharacterAdded until those finish, meaning you already have a character.

No, It doesn’t. What should I use instead?

Using them is fine, you just might want to do them inside the OnCharacterAdded function (and probably cache the result) instead of before connecting to anything. I don’t know if it’s the issue, but it is likely an issue.

1 Like