Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Load player before script? HELP.

Asked by 4 years ago
Edited 4 years ago

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)
0
I could use a wait() but im trying to waitForChild and am struggling. GuestRealization 102 — 4y
0
Don't you do player:WaitForChild("leaderstats") biggun428 8 — 4y
0
At the bottom? GuestRealization 102 — 4y
0
Didn't work. GuestRealization 102 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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.

Ad

Answer this question