Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

when the player resets they get their money back?

Asked by 7 years ago
Edited 7 years ago

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

Log in to vote
0
Answered by
Astilev 30
7 years ago

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)
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 YoMomma121121 -11 — 7y
Ad

Answer this question