So I have multiple values and for some reason, the name will not go and it will be named value.
Code:
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("CashSaveSystem")
local workerz = DataStore:GetDataStore("workerz")
local Work = game.ReplicatedStorage.Work
game.Players.PlayerAdded:connect(function(player)
local leader = Instance.new("Folder",player)
leader.Name = "leaderstats"
local hidden = Instance.new("Folder",player)
hidden.Name = "hidden"
local Cash = Instance.new("IntValue",leader)
local Workers = Instance.new("IntValue", leader)
local Cooldown = Instance.new("IntValue", hidden)
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)
Workers.Name = "Workers"
Workers.Value = workerz:GetAsync(player.UserId) or 0
workerz:SetAsync(player.UserId, Workers.Value)
Workers.Changed:connect(function()
workerz:SetAsync(player.UserId, Workers.Value)
Cooldown.Name = "cooldown"
Cooldown.Value = 0
end)
end)
game.Players.PlayerRemoving:connect(function(player)
ds:SetAsync(player.UserId, player.leaderstats.Cash.Value)
end)
Work.OnServerEvent:Connect(function(Player)
if Player.hidden.cooldown.Value == 1 then
print("cooldown not over")
else
Player.leaderstats.Cash.Value = Player.leaderstats.Cash.Value + 1
Player.hidden.cooldown.Value = 1
wait(5)
Player.hidden.cooldown.Value = 0
end
end)
end)

2 comments
Try changing the properties of each IntValue right after you add them to the game. For example, you can add Cash first and then change its properties. After you do that, do the same thing for the next value and so on. I'm not too sure, but I think people use that order more often.
that didnt work, but it led to me figuring out that it was because of my datastore so thank you!