Script goes crazy, how to put a cooldown on it?
Hello, I've got this kind of simple script here, it works like this:
You touch a part, and then a model moves.
The problem is, if you keep touching the part, which isn't supposed to happen, the script goes nuts and moves way too fast.
How do I fix this?
Script:
01 | workspace.BlockingGate.PrimaryPart = workspace.BlockingGate.Center |
03 | script.Parent.Touched:connect( function () |
07 | workspace.BlockingGate:SetPrimaryPartCFrame( CFrame.new(workspace.BlockingGate.PrimaryPart.Position + Vector 3. new( 0 ,- 0.5 , 0 )) ) |
18 | workspace.BlockingGate:SetPrimaryPartCFrame( CFrame.new(workspace.BlockingGate.PrimaryPart.Position + Vector 3. new( 0 ,- 0.5 , 0 )) ) |
Thanks for helping