Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

DataStore saving appearance help?

Asked by 5 years ago

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?

2 answers

Log in to vote
0
Answered by 5 years ago

I fix this by using

repeat wait() until Player.Character

Try putting that in before loading the shirts and stuff

Ad
Log in to vote
0
Answered by 5 years ago

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.

Answer this question