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

The datastore wont change it's value to the leaderstats value, why?

Asked by
CL4VIN 9
5 years ago

I was using a bunch of different datastore scripts, none of them worked and I was stumped, I decided to use the Alvinblox one and it didn't work, I went into the console and saw that the datastore was set to the right value, but it wasn't changing the leaderstats to that value.

01local DataStoreService = game:GetService("DataStoreService")
02 
03local myDataStore = DataStoreService:GetDataStore("myDataStore")
04 
05game.Players.PlayerAdded:Connect(function(player)
06    local leaderstats = Instance.new("Folder")
07    leaderstats.Name = "leaderstats"
08    leaderstats.Parent = player
09 
10    local cash = Instance.new("IntValue")
11    cash.Name = "Dollaroos"
12    cash.Parent = leaderstats
13 
14    local data
15    local success, errormessage = pcall(function()
View all 40 lines...

all I did was modify his script because I didn't want to break it.

0
are you changing the actual server side's stat not just the client side's 0msh 333 — 5y
0
See, I'm not entirely sure... how would I change the server side stat? CL4VIN 9 — 5y
0
basically is this a normal script or a local script jediplocoon 877 — 5y
0
Normal CL4VIN 9 — 5y
View all comments (4 more)
0
And it's inside server script service CL4VIN 9 — 5y
0
To change the value on the server click on the 'Current' on the home tab at the top of your screen(while playing). It should say 'Current: Client', once you click it, it will take you to the Server Side, then go to Players, your player and change the value of your cash and see if it saves when you stop and play again. xInfinityBear 1777 — 4y
0
Alright, thanks. CL4VIN 9 — 4y
0
Ok, it works. The issue was the way I was adding to the value... My suspicion was right. How am I supposed to make it so that you click on something and it adds it through the server? CL4VIN 9 — 4y

Answer this question