This will save the gear to data store as a encoded table.
This script can go anywhere in the game as long as it is not disabled.
MAKE SURE: The gear is in the player`s startergear.
01 | local ds = game:GetService( "DataStoreService" ):GetDataStore( "Gear" ) |
02 | function savegear(player) |
04 | for i,v in pairs (player.StarterGear:GetChildren()) do |
05 | table.insert(gear,#gear+ 1 ,v) |
10 | game.Players.PlayerRemoving:connect( function (plr) |
11 | savedgear = savegear(plr) |
12 | ds:SetAsync(plr.userId.. "_Gear" ,game.HttpService:JSONEncode(savedgear)) |
15 | game.Players.PlayerAdded:connect( function (plr) |
16 | loadedgear = game.HttpService:JSONDecode(ds:GetAsync(plr.userId.. "_Gear" )) |
17 | if loadedgear~ = nil then |
18 | for i,v in pairs (loadedgear) do |
19 | v.Parent = plr.StarterGear |
Observe this code, edit it to save points instead of gear. CAUTION: This might work no guarantees, feel free to edit the code if needed.