script.Parent.MouseClick:Connect(function() if debounce == true then print ("Cooldown.") else debounce = true game.Players.PLAYERHERE.leaderstats.Clicks.Value = game.Players.PLAYERHERE.leaderstats.Clicks.Value + 1 wait (0.05) debounce = false end end)
This is inside a script, which is inside a click detector, inside a button.
I'm trying to figure out what to put as "PLAYERHERE". "Local Player" does not work for me. I have tested that the script works with my own username, but of course, I want it to be for the person who clicked it.
script.Parent.MouseClick:Connect(function(player) if debounce == true then print ("Cooldown.") else debounce = true player.leaderstats.Clicks.Value = player.leaderstats.Clicks.Value + 1 wait (0.05) debounce = false end end)
Try this. The parameter is the player that clicks the button so player is already defined.