I have a script that when a character runs over the top of a part, the part will go sideways a tiny bit, but when it is touched, instead of moving sideways, it will go upwards infinitely. Script:
local Part = workspace.ManholeCover.Union -- this is the Part we will move local newPos = Part.Position + Vector3.new(-27.313,285.446,-9.8) -- the position the Part will go to local Time = 0.5 -- the time that the script will take to move the part local Increment = 0.5 -- the Part will move 0.5 studs each time it moves local Debounce = false local Diff = newPos - Part.Position -- the difference between the two positions local Mag = Diff.magnitude -- the distance between the two parts local Direction = CFrame.new(Part.Position, newPos).lookVector function MovePart() -- function to move the Part if Debounce then return end -- end the function if debounce is true Debounce = true -- make Debounce true so the function can't run for n = 0, Mag, Increment do Part.CFrame = Part.CFrame + (Direction * Increment) wait( (Time/Mag) * Increment ) end Debounce = false -- set Debounce to false so the function can run again end workspace.ManholeCover.Union.Cell.Touched:connect(MovePart)
It's because of the method you use to move the manhole. Using TweenService is a lot easier. I just explained this with an example on another question, and if I put it here I'll pretty much just be repeating myself, so check out what I said in my answer there, please: Link