Im trying to get together a script that will save "ONLY" the weapons that go into StartGear. There are shops that when you buy the item it goes into StarterGear. However when I leave the server and come back it does not remember that I purchased it...
Here is thy script:
game.Players.PlayerRemoving:connect(function(p)
if p:findFirstChild("StarterGear") then
p:SaveInstance("SavedStatPNum"..tostring(game.PlaceId),p.StarterGear)
end
end)
game.Players.PlayerAdded:connect(function(p)
for k = 1, 60, 0.03 do
wait()
if p:findFirstChild("StarterGear") and p.DataReady then break end
end
local Loaded = nil
if p:findFirstChild("StarterGear") and pcall(function() Loaded = p:LoadInstance("SavedStatPNum"..tostring(game.PlaceId)) end) then
for j, v in pairs(Loaded:GetChildren()) do
pcall(function() p.StarterGear[v.Name].Value = v.Value end)
end
end
end)

2 comments
Well I used this exact script but for my leader board, and it works for that...
Your script uses Data Persistence, which is deprecated. Try to switch to Data Stores.