Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Save tools is possible ?

save tools of a player "StarterGear" is possible ? example: the player purchase a gun and he have the gun in his inventory and he leave the game, i want to know if it's possible if when he rejoin the place, the gun are alway in his inventory... "StarterGear"

2 answers

It is possible, but not as simple as you think. Using a DataStore, you'd record the player purchasing the item, and saving it in the DataStore. Then, you'd check the DataStore every time a player joins the game, and see if they purchased a product, then load it in. It'll take some practice with DataStore.

You can use DataStores to save values.

http://wiki.roblox.com/index.php?title=Data_store

Just save a table of the player's items in his inventory whenever he leaves. Example:

local datastore = game:GetService("DataStoreService"):GetDataStore("Gear")

game.Players.PlayerAdded:connect(function(plr)
	local key = "user_" .. plr.UserId

	local items = datastore:GetAsync(key) or {}
end)

There is a basic setup for a datastore, hope I helped!

2 comments

0

Is game:GetService("DataStoreService") or game:GetService("DataStore")?

1

DataStoreService, I am so sorry lol

This discussion is preserved as it was. New answers, comments, and votes are closed.