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

hello can i get help with my data store script please?

Asked by 6 years ago

hey there i made a dev product so when they buy more cash it works but how would i save that i have a data store script but how would i save if they bought 300 when they leave they still have the 300 they bought plus the money they had before i have a data store script to save the cash but it dosent save the bought cash :)

0
Your kinda talking about a admin tools thing, but sadly i don't understand, can i see ur script? ment34591 20 — 6y
0
Use the Gamepass Service and simply store it as a Gamepass. Then use data storing. DeceptiveCaster 3761 — 6y
0
saving your cash?? i dont undrstand your questions User#20192 0 — 6y
0
Please show your scripts or code, this is not an request site. NexoKami 12 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
local DSS = game:GetService("DataStoreService"):GetDataStore("MoneySave")

game:GetService("Players").PlayerAdded:Connect(function(player)
    local key = "player_" .. player.UserId
    local money = player:WaitForChild("Money") --if this is a value you have
    money.Value = DSS:GetAsync(key)
end)

game:GetService("Players").PlayerRemoving:Connect(function(player)
    local key = "player_" .. player.UserId
    local money = player:WaitForChild("Money") --if this is a value you have
    DSS:SetAsync(key,money.Value)
end)
0
thank you WaifulSbae 0 — 6y
0
accept the answer please Gey4Jesus69 2705 — 6y
Ad

Answer this question