I made a button game that uses debounce as a cooldown before button is usable, but I also want the button to cancel the cooldown whenever this script is in workspace and I inserted this script onto workspace. However, I do not know to advanced of scripting so I need help if I need corrections on my script.
1 | Button = script.Parent |
2 | if local debounce = = false then |
3 | wait( 10 ) |
4 | local debounce = true |
5 | Button.Material = ( "Neon" ) |
6 | end |
P.S. This is a local script I put in
When you use "local" before something, it turns it into a variable. So, you need to define your debounce variable and then after that just say "debounce" without the "local" part. An example of your code with some changes:
1 | local button = script.Parent |
2 | local debounce = true |
3 | if debounce = = false then |
4 | wait( 10 ) |
5 | debounce = true |
6 | button.Material = Enum.Material.Neon |
7 | end |
Hope this helps! (Also, if you use a LocalScript, the changes made by it will only affect the player who fires the function. Use a regular script if you want the changes to be seen across the whole server.)