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

How can I save a player's in-game earned gear?

Asked by 10 years ago

In my game, players can use in-game currency to purchase fun gears. I would like to know how I can save a player's in-game gear when they leave and join the game.

Thank you!

1 answer

Log in to vote
0
Answered by 10 years ago

Hai cyclox You can change Tool to anything but you also gotta change in Loading sequence

Saving Below

    if game.Players.LocalPlayer:WaitForDataReady() then
    player = game.Players.LocalPlayer
    player:WaitForChild("Backpack")
    player:SaveInstance("Tool", player:FindFirstChild("Backpack"):FindFirstChild("ToolName"))
    end

Loading Below

game.Players.PlayerAdded:connect(function(player)
    if player:WaitForDataReady() then -- Wait for the player's data cache to load or skip if it doesn't
        print(player:LoadInstance("Tool"))
    end
end)

IMPORTANT: You will have to add the Save feature to activate when the player bought the item

0
This is not fully finished, if you did not know that. fireboltofdeath 635 — 10y
0
Do I place both into the same script? DrCylonide 158 — 10y
0
No. You make the Save activate after the user buys and item. Then loading goes in workspace. fireboltofdeath 635 — 10y
Ad

Answer this question