So i was creating a Leader stats Data Store System but it seemed to not be working, I’ve been testing new things and it seems there are no errors but it still will not work. Here is the script:
local dataStoreService = game:GetService("DataStoreService")
local cashData = dataStoreService:GetDataStore("cashData")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local cash = Instance.new("IntValue")
cash.Name = "Cash"
cash.Value = cashData:GetAsync(player.UserId) or 0
cash.Parent = leaderstats
cash.Changed:Connect(function()
cashData:SetAsync(player.UserId, cash.Value)
end)
end)
If anyone has an answer to my problem please reply to the post! Thank you!