Ad
Log in to vote
1

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

Asked by 7 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 7 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 — 7y
0
Do I place both into the same script? DrCylonide 158 — 7y
0
No. You make the Save activate after the user buys and item. Then loading goes in workspace. fireboltofdeath 635 — 7y
Ad

Answer this question