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

How Do You Award Player Points Function onClicked? HELP!

Asked by 8 years ago

This is what I tried, but it doesn't work. How do you award the player some player points when he clicks the part? Thanks!

local debounce = true
local PointsService = game:GetService("PointsService")

function onClicked(playerWhoClicked)
    if debounce == true then
        debounce = false
        playerWhoClicked:AwardPoints(playerWhoClicked.userId, 1)
        wait(1)
        debounce = true
    end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Answer this question