So few things you need to know - When you click a union it is supposed to give you 1 "Money" - I already have a leaderboard script in the game - It works on solo studio but not in a server, so I added a Wait for child, but it still doesn't work. I'm not sure how to fix it so I came upon this site and asked this question. Here is the script:
local Clicked = script.Parent:WaitForChild("ClickDetector") Clicked.MouseClick:Connect(function(player) game.Players.LocalPlayer.leaderstats.Money.Value = game.Players.LocalPlayer.leaderstats.Money.Value + 1 end)
you create the stats from another script, so here it may not have loaded. waitforchild on the stats
script.Parent.ClickDetector.MouseClick:Connect(function(plr) local stats = plr:WaitForChild(“leaderstats”) if stats then local money = stats:FindFirstChild(“Money”) if money then money.Value = money.Value + 1 end end end)