Hello guys, i need your help for my leaderboard script, the cash value increase +1 per second in roblox studio but not in roblox game, the value stay at zero :/ idea ?
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("CashSaveSystem")
game.Players.PlayerAdded:connect(function(player)
local leader = Instance.new("Folder",player)
leader.Name = "leaderstats"
local Cash = Instance.new("IntValue",leader)
Cash.Name = "Cash"
Cash.Value = ds:GetAsync(player.UserId) or 0
ds:SetAsync(player.UserId, Cash.Value)
Cash.Changed:connect(function()
ds:SetAsync(player.UserId, Cash.Value)
end)
end)
game.Players.PlayerRemoving:connect(function(player)
ds:SetAsync(player.UserId, player.leaderstats.Cash.Value)
end)
while wait(1) do
game.Players.LocalPlayer.leaderstats["Cash"].Value=game.Players.LocalPlayer.leaderstats["Cash"].Value+1
end
Click on view source for all code

1 comment
Your script is local?