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






Active = false function OnHit(Touch) if Active == true then return end Active = true for i=1,79 do for _,v in pairs(script.Parent.Parent.Parts:GetChildren()) do v.CFrame = v.CFrame * CFrame.new(0,0.1,0) wait(.01) end wait(3) for i=1,79 do for _,v in pairs(script.Parent.Parent.Parts:GetChildren()) do v.CFrame = v.CFrame * CFrame.new(0,-0.1,0) wait(.01) end Active = false end end end script.Parent.Touched:connect(OnHit)

Can someone help me please?

1 answer

Log in to vote
0
Answered by 9 years ago
debounce = false

script.Parent.Touched:connect(function(hit)
if debounce  == true then return end
debounce = true
if hit.Parent:findFirstChild("Humanoid") then
   for i = 1,20 do
    script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,0.5)
     wait()
     end

wait(1)
for i = 1,20 do 
    script.Parent.CFrame = script.Parent.CFrame + Vector3.new(-0,0,-0.5)
   wait()
end
end
debounce = false
end)
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