How can i save owned tools?

Hey, i wanna make a shop gui that you can buy tools in, but then i want it so that when you buy the tools they save when you leave the game, so if i equip a red sword i wanna be able to join the game again with that tool unlocked and im equipping it, because i equipped it. How can i make something like this?

1 Like

Simply use a datastore. (EXAMPLE)

-- Get the DataStore for the player's tools
local toolsDataStore = game:GetService("DataStoreService"):GetDataStore("PlayerTools")

-- Save the tool to the DataStore
toolsDataStore:SetAsync(player.UserId, toolId)

You can’t save instances by default so you can use this module to convert an instance to a table, save it, and then once you unload it, convert it back to an instance with the same properties it had before.

It’s a pretty cool module, it’s hard to save instances yourself so this module saves you a lot of time. It’s very simple to use as well, I use it for my game that has plots where players can build on plots.

The second option however, is to create a folder inside the player whenever they join and create BoolValues for each tool, then you can determine if the player had the tool before by just checking the value of the BoolValue and then save/load.

(Do your checks on the server, exploiters will be able to manipulate the values locally and the local script will detect that, while a server scripts doesnt.)