No errors, but i need to know how to fix this so after these two parts go up, after 5 seconds, it goes down to its original position.
part = script.Parent.Part part2 = script.Parent.Part2 function move() for i= 0.1 ,50 do wait(0.1) b = 0.1+0.1 part.Position = part.Position+Vector3.new(0,b,0) part2.Position = part2.Position+ Vector3.new(0,b,0) script.Parent.ClickDetector.MaxActivationDistance = 0 end wait(5) for i= 0.1 ,50 do wait(0.1) b = 0.1+0.1 part.Position = part.Position+Vector3.new(0,b,0) part2.Position = part2.Position+ Vector3.new(0,b,0) script.Parent.ClickDetector.MaxActivationDistance = 32 end end script.Parent.ClickDetector.MouseClick:connect(move)
You are still adding in the second part, you need to subtract:
part = script.Parent.Part part2 = script.Parent.Part2 function move() for i= 0.1 ,50 do wait(0.1) b = 0.1+0.1 part.Position = part.Position+Vector3.new(0,b,0) part2.Position = part2.Position+ Vector3.new(0,b,0) script.Parent.ClickDetector.MaxActivationDistance = 0 end wait(5) for i= 0.1 ,50 do wait(0.1) b = 0.1+0.1 part.Position = part.Position-Vector3.new(0,b,0) part2.Position = part2.Position- Vector3.new(0,b,0) script.Parent.ClickDetector.MaxActivationDistance = 32 end end script.Parent.ClickDetector.MouseClick:connect(move)