Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How come it won't stop moving?

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

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)

3 comments

0

That didn't help as i'm trying to move multiple parts. Not just one

0

put them at all parts lol

0

I tried that, It still does the same thing.

This discussion is preserved as it was. New answers, comments, and votes are closed.