How do I wait for the character to load in my script?
I have a custom character load script that changes the character's re-spawn time and a name tag script in ScriptServices so that they run as soon as the player joins but I can't get the name tag script to wait for the character to load. This is the script:
01 | local NameTagGui = game:GetService( "ServerStorage" ):WaitForChild( "NameTagGui" ) |
02 | game:GetService( 'Players' ).PlayerAdded:Connect( function (player) |
03 | player.CharacterAdded:Connect( function (character) |
05 | if not game:GetService( "Workspace" ):FindFirstChild(player.Name.. "" ) then |
09 | local humanoid = character:FindFirstChild( "Humanoid" ) |
10 | local head = character:FindFirstChild( "Head" ) |
11 | humanoid.DisplayDistanceType = "None" |
12 | local Clone = NameTagGui:Clone() |
14 | Clone.NameTag.Text = (player.Name) |