Help with moving platform not moving character

  1. What do you want to achieve? I want to have a tweened part that also carries the player with the movement, similar to the jailbreak train, except the jump shouldn’t follow the part.

  2. What is the issue? I just dont know how to do this

  3. What solutions have you tried so far? ive literally been searching for hours and ive tried everything i saw

1 Like

step1: raycast down from the player humanoid root part, it should be (origin = humanoidrootpart.Position, Direction = vector3.new(0, -3, 0))

step2: check if the raycast hit the platform

step3: update the humanoid root part position relative to the platform, this is done by using renderstepped, ToObjectSpace, and ToWorldSpace.

all of this should be done only on the client side

tho this is low effort but it should give you a rough idea on how jailbreak train work

2 Likes

For an example implementation of what @supercronter4 described (including some explanations for resolving several issues that came up along the way), I’d recommend referring to the following thread, which has a fully working example test place and the standalone LocalScript code provided in the post after the solution:


Edit: However, one caveat I should note is that the solution in the thread I referenced does make the Character continue to follow the part if they jump while standing over it (so that’s something that would need to be modified from the completed example to match your use case).

Edit #2: Funnily enough, the code included in the original post (rather than the one after the solution) might be better suited for your use case, given that when players jump while standing on a moving platform, they start to “fly away” in the opposite direction that the platform is moving in. Because of that, I’d recommend trying out the code from the original post first to see if it better matches what you’re trying to achieve.

1 Like

If it only needs to move in a straight line just use a platform moved by a PrismaticConstraint. They are physics driven so they’ll move a player just like you want.

2 Likes

how could i make this go back and forth? i’m not used to using prismatic constraints.

2 Likes

thanks for your reply, this taught me stuff that i didnt already know when trying it.

2 Likes

thanks for replying, once i have a little more time i’ll read the post you linked.

2 Likes

They are very simple. I made a free sample one for someone who wasn’t familiar. (Seems like you can’t just post items straight from your own inventory anymore?) The link takes you to the model in the Creator Store…
https://create.roblox.com/store/asset/7645980152/PlatformModel?viewFromStudio=true&keyword=&searchId=46CF60DD-0DDF-40A3-B053-FB49CEC92D98

You can change the Servo TargetPosition in a script to make it stop and start wherever you want.

Also check out the Roblox Documentation:
Constraints PrismaticConstraint | Documentation - Roblox Creator Hub
Classes PrismaticConstraint | Documentation - Roblox Creator Hub

4 Likes

Thanks for helping me and teaching me! I do have a question though, how would it work for a platform going up/down? I tried a few things but couldn’t figure it out.

1 Like

Just know that setting a part’s CFrame will not move anything with it (you are not applying physics).

Consider using Mover Constraints if you want to move objects along with it.

2 Likes

Select both Attachments and rotate them 90 degrees.
PrismaticConstraints move back and forth along the yellow arrow line of the Attachments which show up when you select them in the Workspace. The orange arrow shows the orientation of the Attachments. Both arrows have to be pointing the same direction on both Attachments.
They don’t even have to be vertical. I have elevators that run on tracks in my Steampunk showcase place.
Constraints can be used for car suspensions, cranes, moving a simple trolley in a straight line and other things. Check out the Construction Site on my profile to see some cool things you can do with them.

2 Likes