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

Changing Leaderstats with a Clickdetector?

Asked by 4 years ago
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.

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
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.

0
Thank you! Doglover9190 4 — 4y
Ad

Answer this question