How to enable script by button press ?
Button = script.Parent
-Thank u and best regards ! -PPJASK
How to enable script by button press ?
Button = script.Parent
-Thank u and best regards ! -PPJASK
you can use the function MouseButton1Click with the button to tell when the button is being pressed
button = script.Parent
button.MouseButton1Click:Connect(function()
some_script.Disabled = false -- add a variable to some_script for which script you want to disable
end)
Hi, if you want to enable a script whenever you click on the button then you would insert a click detector into the button you want and then write this script:
local clickDetector = workspace.Nameofbuttonhere.ClickDetector -- Write the location of were the clickdetector is in the workspace
function onMouseClick()
print("You clicked me!") ---Print this whenever the button is clicked to double check that it is working, add whatever code you wanna write here
end
clickDetector.MouseClick:connect(onMouseClick) -- Run whenever you click
Here more info on the Roblox API: https://developer.roblox.com/en-us/api-reference/class/ClickDetector
If this answer had helped please up vote and click answered
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
what do you mean by enabling a script. Do you mean turning the Disabled property of the script to false?
yes