1 | wait () |
2 | while true do |
3 | wait () |
4 | script.Parent.InputBox.InputEnded:Connect( function () |
5 | print (script.Parent.InputBox.Text) |
6 | script.Parent.InputBox.Text = "" |
7 | end ) |
8 | end |
How whould you prevent this script from running 200 times?
Hello, MageMasterHD!
To make that, do the following:
1 - Remove the While Loop
2 - Add debounce
Edited Script
01 | wait () |
02 | local deb = false --Debounce variable |
03 | script.Parent.InputBox.InputEnded:Connect( function () --This is a event, no loops needed =D |
04 | if ( not deb) then --Test for debounce(prevent running several time) |
05 | deb = true --sets debounce to true |
06 | print (script.Parent.InputBox.Text) |
07 | script.Parent.InputBox.Text = "" |
08 | wait( 5 ) --Debounce Time |
09 | deb = false --sets debounce to false |
10 | end |
11 | end ) |
Good Luck with your games
I do believe there is a way to disconnect functions. I do not know much about this but I do think it works. Correct me if I am wrong.
1 | wait () |
2 | while true do |
3 | wait () |
4 | clicked = script.Parent.InputBox.InputEnded:Connect( function ( |
5 | print (script.Parent.InputBox.Text) |
6 | script.Parent.InputBox.Text = "" |
7 | clicked:disconnect() |
8 | end ) |
9 | end |
Try it and it might work but I am not 0 sure I posted this answer so that if it did work then it would help you.
Hope it works!