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

when the player resets they get their money back?

ok so i started working on a game with a friend and i noticed that when you reset, your money goes back to what it was when u first joined, and i havent learned how to use datastore yet so i just wanted to temporarily have it not save and when u join u start with 2000 cash. but all i have is a stats folder inside of player then a money NumberValue inside of it. it will go down when you buy stuff but when u reset it goes back to 2000 i dotn understand what i did wrong

1 answer

You can just run a localscript in StarterGui to set their stat to 2000. DataStore isnt necessary if all you want to do is make it reset to 2000 every time they reset.

As for keeping their money at the start of each game, you could use DataStore.

data =game:GetService("DataStoreService"):GetDataStore("money")

game.Players.PlayerAdded:connect(function(plr)
	local key = "user_"..plr.userId
	your money value = data:GetAsync(key)
	--store this value somewhere else and have a localscript in startergui to run it and restore their money every time they reset
end)

game.Players.PlayerRemoving:connect(function(plr)
	local key = "user_"..plr.userId
	data:SetAsync(key, your money value)
end)

1 comment

0

no, i meant that i do not want it to go back to 2000 when they reset i just want it to where, hen they join they have 2000 cash and if they die, their cash wont reset and go back up to 2000

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