ReplicatedStorage and :PlayerRemoving() problem
Hello, I have a ShopGUI that perfectly working, equipping, buying, etc. But I want to save it with DataStoreService. I’m tried a lot of ways but not successful. Because there is a problem in PlayerRemoving function.
Here how I’m storing PlayerData:

There is no problem until PlayerRemoving function.
Problem:

Prints “Nil”:
What is the problem? Why the script can’t find the Player Information Folder?
Are you sure that rep is refering to the folder “AllPlayerInformations”?
1 Like
Are the folders created from a local script? If not, try using :WaitForChild().
@OP Did you try what I suggested above? ^^
1 Like
Yes, also it’s works in game. But I dont know why not works at the end.
Try keeping a reference upon creation like this
local list = {}
playeradded:Connect(function(plr)
local x = blah:Clone()
x.Parent = blah blah blah
x.Name = blah
list[plr] = x
end)
playeremoving:Connect(function(plr)
list[plr] ...
end)
Thanks. It looks easier and better. 
Thanks for the help, I’m tried it.
local rep = ReplicatedStorage:WaitForChild("AllPlayerInformations")
I did it wrong. Thanks for the help 
1 Like
Good job!
Have a great day! Keep on developing.
1 Like