Making a player move while standing on a moving part

So I am creating a moving part that moves back and fourth via tweens. I want to know how to make it so if a player stands on top of the platform the player moves with it. Perhaps a velocity calculation or weld.

The platform:


1 Like

You can use a prismatic constraint instead of tweens. I have a model, but I’m unable to provide it to you.

The problem is you are using a tween to move a part, so no game physics are calculated and parts resting on top don’t know how to react. You need to use a body mover or a constraint. Here is an example. Paste this into a new workspace as a Server Script.

local part1 ="Part")
part1.Anchored = true
part1.Position =, 0.5, -21)
local attachment ="Attachment")
attachment.Position =,0,-1)
attachment.Parent = part1
part1.Parent = game.Workspace

local part2 ="Part")
part2.Anchored = false
part2.Position =, 0.5, -25)
part2.Size =, 1, 6)
local attachment2 ="Attachment")
attachment2.Position =, 0, 3)
attachment2.Parent = part2

local constraint ="PrismaticConstraint")
constraint.Attachment0 = part2.Attachment
constraint.Attachment1 = part1.Attachment
constraint.ActuatorType = Enum.ActuatorType.Motor
constraint.LimitsEnabled = true
constraint.LowerLimit = -15
constraint.UpperLimit = 15
constraint.MotorMaxForce = 10000
constraint.Velocity = 10
constraint.Parent = part2

part2.Parent = game.Workspace

while true do
	if constraint.CurrentPosition >= constraint.UpperLimit then
		local temp = constraint.Attachment0
		constraint.Attachment0 = constraint.Attachment1
		constraint.Attachment1 = temp

Most definitely! I will look into this method, thanks a lot.

I meant that he should create a prismatic constraint(prior to running) , and then simply alternate from point A to B (Upper to Lower limits)

Yeah, I was able to figure out the whole constraint thingy and have it set up so when it touches certain bricks it will go in a different direction making a back and fourth motion. Thanks for your recommendations.

1 Like