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

Why won't the money save when I test it?

Asked by 5 years ago

The script won't save the money in studio.

Here is the code:

local DSS = game:GetService("DataStoreService")

local Money = DSS:GetDataStore("Cash")

game.Players.PlayerAdded:Connect(function(plr)

local pCash = Money:GetAsync(plr.UserId)or 10

local leaderstats = Instance.new("Folder",plr)

leaderstats.Name = "leaderstats"

local CashValue = Instance.new("NumberValue")

CashValue.Name = "Cash"

CashValue.Value = pCash

CashValue.Parent = leaderstats

CashValue.Changed:connect(function(v)

Money:SetAsync(plr.UserId,v)

end)

end)

I hope you can help, thank you!

0
if you are going, into workspace and manually changing it, it wont save since it would be local, you gotta either change it with a regular script or, click on the blue computer icon on the top while your testing to go into server mode and change it fireshoots25 5 — 5y
0
It's in a script in ServerScriptService Luke2323244 17 — 5y

1 answer

Log in to vote
0
Answered by
enes223 327 Moderation Voter
5 years ago

Because studio cant use datastore service, test it in published game.

0
Oh right. Luke2323244 17 — 5y
Ad

Answer this question