https://pastebin.com/raw/rwcjxddL
I am trying to make a datastore which saves/loads shirts and pants when you join or leave the game. The problem Is that Player.Character returns nil and at line 18 Saved Clothes is nil. Help?
I fix this by using
repeat wait() until Player.Character
Try putting that in before loading the shirts and stuff
Same idea as roy6576's answer, but without a repeat until loop.
local character = player.Character or player.CharacterAdded:Wait()
When the player joins, the character isn't instantly loaded. The code above will be set to player.Character if it exists, else it will wait for it to exist and then set it to player.Character.