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

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

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!

2 comments

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

0

It's in a script in ServerScriptService

1 answer

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

1 comment

0

Oh right.

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