Is there a way to stuck the position/rotation of an object that is being influenced by physics?

Hello everyone! I am trying to learn how to code and I decided to start by Roblox Lua. I am trying to make a moving platform, and I used BodyGyro and BodyPosition to make the player actually move with it. As much as it works, the platform floats and takes the player with it, there are some problems. For example: I can’t provided video of the platform (by the way, if someone knows something that could make light videos/light gifs I would be much appreciated), but the player can push the platform away and spin it when he touches it by its sides. I am gonna send out the code:

local part = script.parent
local bp = part.BodyPosition
local bg = part.BodyGyro

while true do
	repeat
		bp.Position = bp.Position + Vector3.new(0,0,1)
		wait(0.1)
	until bp.Position.Z >= 0  --By the way, the position is 36, 4.5, -20.5
	repeat
		bp.Position = bp.Position + Vector3.new(0,0,-1)
		wait(0.1)
	until bp.Position.Z <= -20.5
	
end

Here are the pics of the properties of the BodyGyro and BodyPosition:
1 2
Anyways, I think it might be impossible to freeze it’s position and rotation without interfering with the platform’s normal movement, but I am a newbie so I can’t really tell. Thank you for reading!

1 Like