I am making a part which is moving horizontally between 2 parts. I want this part to be collidable with players. Everything works fine but when a player touches the moving part, the moving part begins to rotate. Is there a way to prevent the part from rotating when a player collides with it?
These are the 3 parts I am using for this:
The parts named “Finish” and “Start” are non-collidable (as you can see in the video). The moving part is collidable.
and this is the script:
start = script.Parent.Parent:FindFirstChild("Start")
finish = script.Parent.Parent:FindFirstChild("Finish")
bodyposition = script.Parent:FindFirstChild("BodyPosition")
while true do
bodyposition.Position = start.Position
wait(2)
bodyposition.Position = finish.Position
wait(2)
end
Can someone explain me how to prevent the part from rotating when colliding with a player?
I believe the part has CanCollide set to true and isn’t anchored.
This means that if any object (including the player) exerts a force on hit, for example, by walking into it, then the object will be affected and rotate.
To prevent this, you can use the :Lerp() function or use TweenService to make the Part unaffected by other objects. TweenService should also be more efficient than the BodyPosition and also allows you to easily tweak how you want the movement to behave.