Hello. i want to make doors that when you touch them they move up. The problem is that once i touch them, they won't stop moving. I can't seem to figure out what is the problem. Here is the script i have
01 | Active = false |
02 | function OnHit(Touch) |
03 | if Active = = true then return end |
04 | Active = true |
05 |
06 | for i = 1 , 79 do |
07 | for _,v in pairs (script.Parent.Parent.Parts:GetChildren()) do |
08 | v.CFrame = v.CFrame * CFrame.new( 0 , 0.1 , 0 ) |
09 | wait(. 01 ) |
10 | end |
11 | wait( 3 ) |
12 | for i = 1 , 79 do |
13 | for _,v in pairs (script.Parent.Parent.Parts:GetChildren()) do |
14 | v.CFrame = v.CFrame * CFrame.new( 0 ,- 0.1 , 0 ) |
15 | wait(. 01 ) |
Can someone help me please?
01 | debounce = false |
02 |
03 | script.Parent.Touched:connect( function (hit) |
04 | if debounce = = true then return end |
05 | debounce = true |
06 | if hit.Parent:findFirstChild( "Humanoid" ) then |
07 | for i = 1 , 20 do |
08 | script.Parent.CFrame = script.Parent.CFrame + Vector 3. new( 0 , 0 , 0.5 ) |
09 | wait() |
10 | end |
11 |
12 | wait( 1 ) |
13 | for i = 1 , 20 do |
14 | script.Parent.CFrame = script.Parent.CFrame + Vector 3. new(- 0 , 0 ,- 0.5 ) |
15 | wait() |
16 | end |
17 | end |
18 | debounce = false |
19 | end ) |