game.Players.PlayerAdded:Connect(function(Player)
local function CharAdded()
local OverHeadUi = game.ReplicatedStorage.Info:Clone()
OverHeadUi.Parent = Player.Character.Head
OverHeadUi.Main.Rank.Text = Player:GetRoleInGroup(5330486)
OverHeadUi.Main.Username.Text = Player.Name
print("End")
end
if Player.Character then
CharAdded(Player.Character)
end
Player.CharacterAdded:Connect(CharAdded)
end)
It’s probably a little mistake but for some reason i can’t see it. It prints end so it does run through.
The issue with the code seems to be that you are passing an argument to the CharAdded function, but the function definition doesn’t include any arguments. To fix this, you can add a parameter to the function definition to accept the Character argument. Here’s the updated code:
game.Players.PlayerAdded:Connect(function(Player)
local function CharAdded(Character)
local OverHeadUi = game.ReplicatedStorage.Info:Clone()
OverHeadUi.Parent = Character.Head
OverHeadUi.Main.Rank.Text = Player:GetRoleInGroup(5330486)
OverHeadUi.Main.Username.Text = Player.Name
print("End")
end
if Player.Character then
CharAdded(Player.Character)
end
Player.CharacterAdded:Connect(CharAdded)
end)
This should now properly add the OverHeadUi to the player’s head when they spawn.