So I've been working on a leaderboard script and I'm having a bit of an issue with the SetASync command. I just need a bit of help setting it up. Here is the rest of the code
local DataStoreService = game:GetService("DataStoreService")
local moneyStore = DataStoreService:GetDataStore("moneyStore")
local player = game:GetService("Players")
local function leaderboardSetup(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local cash = Instance.new("IntValue")
cash.Name = "Money"
cash.Value = 0
cash.Parent = leaderstats
local UserID = player.UserId
local money = moneyStore:GetASync(UserID)
if money then
cash.Value = money
else
cash.Value = 0
end
end
game.Players.PlayerAdded:Connect(leaderboardSetup)``
