Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you disable an Onclicked function?

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

An example of the disconnect method suggested by Perci1.

local connection

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

connection = floor1e.ClickDetector.MouseClick:connect(move)
function move()
    transport(finish)
    script.Disabled = true
end

floor1e.ClickDetector.MouseClick:connect(move)

Is this what you wanted?

1 comment

0

It will work, but if he want the script to still run, he would need another script.

This discussion is preserved as it was. New answers, comments, and votes are closed.