DataStores Not Working

Can you please check the output? We cannot help you with your problem if there’s no output.

How r u changing your Currency?

Still not working. But i found a weird thing.
There is a saving leaderstats script in my old game, and it’s working.
But If i create a new place and place script here that’s not working.

My script works. Are you sure you turned on API services?

There’s no output but if i add a print command it works.

I got your problem. I think you didn’t change your currency from the server.

1 Like

Yes and it prints “Data Saved successfully” but not working.

If you change it from a local script it doesn’t work.

Hey, can you run this code when you are running the game inside the command bar?

game.Players.AlienX1258.leaderstats.Cash.Value = 10

No this script is in serverscriptservice and it’s not a local script this is a script.

Change your Mode to Server-Mode first. Then change your currency.

It just changes currency. But still not working.

How do i do? Do you mean Test Server?

Next to the Play button u can change your mode to Server

Are you using Studio Test, because Studio Test doesn’t work (your plr leaves too fast)

Yep that’s worked. Thanks for your labors.

  1. Why are you saving when there is no need to?
Cash.Value = CashValue
CashSave:SetAsync(plr.UserId, Cash.Value) 
--> What is your logic here?
--> It needs to be saved again when they leave.
  1. Wrap your calls in a pcall.
  2. Do not save everytime the value changes.
  3. Include PlayerRemoving and BindToClose.
  4. Assign all the properties before parenting, as that is faster.
1 Like

That’s just because your player left too fast. You should go into a Roblox client instead. I always test datastores in game.

He did all of them, I gave him a script but he doesn’t know how to change the values from the server