How To | Converting a momentary button to a trigger using Lua scripting
Convert a momentary button to a trigger using Lua scripting
If you are not finding the results you need and still have questions, submit a request using the form below and our Tech Docs team will get right on it. Our goal is to provide the content you need!
Your engagement helps us create the content you need. Click here to review this article.
Table of Contents
This function will convert the momentary button press into a triggered output.
- Drag a Text Controller into the design.
- Open the component
- Add two controls
- Set one of the controls to a "Momentary" button, and name it “Btn”
- Set the other control be be a "Trigger" button. and name it “Trigger"
- Open the script editor and copy the code snippet into it
Component.New("Test")["Btn"].EventHandler = function() --This line captures the state change of the button press and runs function if Component.New("Test")["Btn"].Boolean == true then --This line looks at the button presses state to determine if true or not Component.New("Test")["Trigger"]:Trigger() --this line sets Trigger output end end