Need help loading player before script. Ive literally tried everything I can think of and googled so much.
local DSS =game:GetService("DataStoreService") local Money =DSS:GetDataStore("Cash") local Bounty =DSS:GetDataStore("Bounty") game.Players.PlayerAdded:connect(function(player) local pCash = Money:GetAsync(player.UserId) or 0 local pBounty = Bounty:GetAsync(player.UserId) or 0 local leaderstats = Instance.new("IntValue",player) leaderstats.Name = "leaderstats" leaderstats.Parent = player local CashValue = Instance.new("IntValue") CashValue.Name = "Money" CashValue.Value = pCash CashValue.Parent = leaderstats local BountyValue = Instance.new("IntValue") BountyValue.Name = "Bounty" BountyValue.Value = pBounty BountyValue.Parent = leaderstats CashValue.Changed:connect(function(v) Money:SetAsync(player.UserId,v) print("Money Has Been Saved for user") end) BountyValue.Changed:connect(function(v) Bounty:SetAsync(player.UserId,v) print("Bounty Has Been Saved for user") end) end)
Someone let me know if this will work:
Localsceipt that waits for player to load then fires server event that has a script that listens for the fired event then creates the leaderboard. I think this will work, not able to test right now.