Here is my script.
01 | --Locals |
02 | local DataStoreService = game:GetService( "DataStoreService" ) |
03 | local MyDataStore = DataStoreService:GetDataStore( "MyDataStore" ) |
04 |
05 | --Stats adder |
06 | game.Players.PlayerAdded:Connect( function (player) |
07 | local leaderStats = Instance.new( "Folder" ) |
08 | leaderStats.Name = "leaderstats" |
09 | leaderStats.Parent = player |
10 |
11 | --Cash stats |
12 | local Cash = Instance.new( "IntValue" ) |
13 | Cash.Name = "Cash" |
14 | Cash.Parent = leaderStats |
15 | -- Load Data |
I have a solution if API services are disabled, turn that on. If that doesn't work then I have my own leaderboard that saves and is much smaller. Feel free to use it
01 | local datastore = game:GetService( "DataStoreService" ) |
02 | local ds 1 = datastore:GetDataStore( "CashSaveSystem" ) |
03 |
04 | game.Players.PlayerAdded:connect( function (plr) |
05 | local folder = Instance.new( "Folder" , plr) |
06 | folder.Name = "leaderstats" |
07 | local cash = Instance.new( "IntValue" , folder) |
08 | cash.Name = "Money" |
09 |
10 | cash.Value = ds 1 :GetAsync(plr.UserId) or 500 --You can replace 500 with how much you want the starting money to be at |
11 | ds 1 :SetAsync(plr.UserId, cash.Value) |
12 |
13 | cash.Changed:connect( function () |
14 | ds 1 :SetAsync(plr.UserId, cash.Value) |
15 | end ) |
16 | end ) |
I see you are doing this:
1 | local Success, errormessage pcall ( function () |
But where is =
?
Try this:
1 | local Success, errormessage = pcall ( function () |
There also could be some stuff about it in the output, this is where you should look for issues.