Hello. I am trying to make a game where you just sit and get lazyness and stuff. but my leaderstats wont work. can someone tell me why?
local ds = game:GetService("DataStoreService")
local ds1 = ds:GetDataStore("Lazyness")
local ds2 = ds:GetDataStore("LPS")
game.Players.PlayerAdded:Connect(function(player)
local folder = Instance.new("Folder", player)
folder.Name = "leaderstats"
local Lazyness = Instance.new("IntValue", folder)
Lazyness.Name = "Lazyness"
local LPS = Instance.new("IntValue", folder)
LPS.Name = "LPS"
Lazyness.Value = ds1:GetAsync(player.UserId) or 0
ds1:GetAsync(player.UserId, Lazyness.Value)
LPS.Value = ds2:GetAsync(player.UserId) or 1
ds2:GetAsync(player.UserId, LPS.Value)
end)
game.Players.PlayerRemoving:Connect(function(player)
local Lazyness = player.leaderstats.Lazyness
local LPS = player.leaderstats.LPS
ds1:GetAsync(player.UserId, Lazyness.Value)
ds2:GetAsync(player.UserId, LPS.Value)
end)
