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

How to make a clickdetector script that does this? [closed]

Asked by 6 years ago

So, i have a script, y'know, simple script.

local player = game.Players.LocalPlayer
local leaderboard = player:WaitForChild("leaderstats")
local price = 30

    if leaderboard.Cashies.Value >= price.Value then
leaderboard.Cashies.Value = leaderboard
leaderboard.Cashies.Value = leaderboard.Cashies.Value - price.Value
leaderboard.Pointies.Value = leaderboard.Points.Value - price.Value
    end
end)

However, how can i make this script be a ClickDetector version? I already have a block with the clickdetector.

And the extra thing that is needed: It needs to work on filtering enabled.

Thanks for listening.

Marked as Duplicate by minikitkat

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 6 years ago

In a server script:

ClickDetector.MouseClick:Connect(function(player)
    local leaderboard = player:WaitForChild("leaderstats")
    local price = 30
        if leaderboard.Cashies.Value >= price.Value then
        leaderboard.Cashies.Value = leaderboard
        leaderboard.Cashies.Value = leaderboard.Cashies.Value - price.Value
        leaderboard.Pointies.Value = leaderboard.Points.Value - price.Value
      end
end)
Ad