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

How do you disable an Onclicked function?

Asked by
nich17 95
9 years ago

i have a simple Onclicked function that i would like to prevent the button from working once the function is called. don't worry about the syntax i just want to know how to make the button not work or not call the function again while it is working. is this possible? and how could i achieve it if so?

function move()
    transport(finish)
end

floor1e.ClickDetector.MouseClick:connect(move)

3 answers

Log in to vote
1
Answered by
Tesouro 407 Moderation Voter
9 years ago

The button can't be clicked if the MaxActivationDistance is null.

function move()
    transport(finish)
    floor1e.ClickDetector.MaxActivationDistance = 0
end

floor1e.ClickDetector.MouseClick:connect(move)
0
You could also use the disconnect method, but your way's probably best in this situation. http://wiki.roblox.com/index.php?title=Disconnect#Methods_2 Perci1 4988 — 9y
0
yeah, it's much simpler Tesouro 407 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

An example of the disconnectmethod suggested by Perci1.

local connection

function move()
    transport(finish)
    connection:disconnect()
end

connection = floor1e.ClickDetector.MouseClick:connect(move)
Log in to vote
-1
Answered by 9 years ago
function move()
    transport(finish)
    script.Disabled = true
end

floor1e.ClickDetector.MouseClick:connect(move)

Is this what you wanted?

0
It will work, but if he want the script to still run, he would need another script. Tesouro 407 — 9y

Answer this question