I have a button, but when I stepped on it, the script runs few times. It would seem that use Debounce and all problems will disappear, but no, then TouchEnded
will stop working.
This simple task left me in a stupor, I have always used Debounce, but in this case it is useless.
What i tried:
Debounce
All variants with Debounce
Region3
Raycast
Script:
script.Parent.Touched:Connect(function() print("stepped on") end) script.Parent.TouchEnded:Connect(function() print("stepped off") end)
Debounce Version:
Debounce = true script.Parent.Touched:Connect(function() if Debounce == true then Debounce = nil print("stepped on") wait(1) Debounce = false end end) script.Parent.TouchEnded:Connect(function() if Debounce == false then Debounce = nil print("stepped off") wait(1) Debounce = true end end)
Help me please.