Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How come it won't stop moving?

Asked by 9 years ago

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

01Active = false
02function OnHit(Touch)
03if Active == true then return end
04Active = true
05 
06for i=1,79 do
07    for _,v in pairs(script.Parent.Parent.Parts:GetChildren()) do
08v.CFrame = v.CFrame * CFrame.new(0,0.1,0)
09wait(.01)
10end
11wait(3)
12for i=1,79 do
13    for _,v in pairs(script.Parent.Parent.Parts:GetChildren()) do
14v.CFrame = v.CFrame * CFrame.new(0,-0.1,0)
15wait(.01)
View all 26 lines...

Can someone help me please?

1 answer

Log in to vote
0
Answered by 9 years ago
01debounce = false
02 
03script.Parent.Touched:connect(function(hit)
04if debounce  == true then return end
05debounce = true
06if hit.Parent:findFirstChild("Humanoid") then
07   for i = 1,20 do
08    script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,0.5)
09     wait()
10     end
11 
12wait(1)
13for i = 1,20 do
14    script.Parent.CFrame = script.Parent.CFrame + Vector3.new(-0,0,-0.5)
15   wait()
16end
17end
18debounce = false
19end)
0
That didn't help as i'm trying to move multiple parts. Not just one purplemetro3421 5 — 9y
0
put them at all parts lol JasonButton1234 0 — 9y
0
I tried that, It still does the same thing. purplemetro3421 5 — 9y
Ad

Answer this question