Character Movement relative to Platform

Hey everyone, this is my first topic! Excited to be in this community.

I’ve been on quite the pickle lately, as I’m currently developing a project with multiple obstacle courses throughout. The thing is, one of said obstacles isn’t really working very well.

I’m trying to implement moving platforms to give players a new facet of danger, yet the script I wrote (CFrame based) doesn’t center my characters movement around the platform’s, which means I get flinged off every time I try to stand on the thing.

How would I be able to construct a physics-based platform so the character’s movement can stay relative to the platforms? Here’s my current script:

local ts = game:GetService("TweenService")
local sp = script.Parent

local info = TweenInfo.new(

2, -- Duration
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut,
math.huge, -- Times Repeated
true, -- Reverse?
0 -- Delay

)

local pos =

{ 
CFrame = sp.CFrame - Vector3.new(23,0,0)
}

local movement = ts:Create(sp,info,pos)
movement:Play()

This is what you’re looking for: Just recently ROBLOX released an update that does this automatically.

Judging from how the article reads, it seems this only applies to non-anchored parts with physics. In other words, don’t manually set the CFrame or Position using TweenService. Also, the article also says small parts don’t apply, so be sure to make the platforms a little big (I got mine to work with 12x1x12 studs).

Have something like a BodyPosition for moving the platform, along with a BodyGyro for making sure the platform doesn’t tilt oddly. You’ll have to mess with BodyPosition’s MaxForce property for overcoming gravity, along with a few others.

1 Like

Damn, so Tween doesn’t work?

This got 200% times harder… Thank you for the help though!