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

Does anybody know how to create a Data Shop?

I have tried one for my game. Unfortunately, I do not have any code snippets to add. I'd really appreciate it if any of you ponder upon my question and create a script for me.

1 comment

0

The name of the question is a little murky, I would appreciate if you would give a better explanation.

1 answer

✓ Accepted answer

You mean a data store? http://wiki.roblox.com/index.php?title=Data_store

Example:

local DataStore = game:GetService("DataStoreService"):GetDataStore("Points")
game.Players.PlayerAdded:connect(function(player)
	local key = "user_" .. player.userId
	--we want to give 50 points to users each time they visit
	DataStore:UpdateAsync(key, function(oldValue)
		local newValue = oldValue or 0 --oldValue might be nil
		newValue = newValue + 50
		return newValue
	end)
end)

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