Need Help With TweenService

Hi! I am trying to make a brick that moves and where you can stand on. I am using TweenService, but if a player stands on the brick this happens:

https://streamable.com/np7g9

Here’s my TweenService code:

local pointA = script.Parent:WaitForChild("PointA")
local pointB = script.Parent:WaitForChild("PointB")

local tweenInfo = TweenInfo.new(
	5,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0,
	false,
	1
)

local tweenToB = game:GetService("TweenService"):Create(pointA, tweenInfo, {CFrame = pointB.CFrame})
local tweenToA = game:GetService("TweenService"):Create(pointA, tweenInfo, {CFrame = pointA.CFrame})

while true do
	wait(5)
	tweenToB:Play()
	tweenToB.Completed:Wait()
	
	tweenToA:Play()
	tweenToA.Completed:Wait()
end

Thanks for reading and I hope you can help me out :slightly_smiling_face:

This reply may help you, but you’ll need to change it to fit in with your code:

I saw that post later but I don’t really understand it.

You can also achieve this using BodyMovers and an unanchored brick instead of TweenService, if you don’t mind the player falling down when jumping.

Okay, I tried it once again, but I need some help with the installation.

You just need to set the Velocity correctly so that the Humanoid follows the part.

Setting the Velocity to the speed of the brick will cause a Humanoid on top to follow it.

I would recommend to set this every RunService.Stepped as this happens right before physics.

How do you set that correct?
And where do I need to place the script?

Set the velocity to how fast the part’s moving. I believe the unit is studs/second.

Tweening the part does not move it physically, therefore the player will not physically move while standing on it. It just looks like it’s being physically moved. If you want to make the player move on it, you would have to use a BodyPosition, as it physically moves the part. You would also have to use a BodyGyro if you do not want the part to spin freely and wobble when the player stands on it.

Not true. You know how conveyor belts work right? They’re anchored parts with a Velocity set, that causes other parts to slide on it. All you need here is a Velocity that matches the speed of your CFraming, and your character (and any other parts on top of it) will move with the platform.

That is another solution, but I find BodyPositions to be more efficient than simply changing the velocity.

I find cranking the power of body movers up high enough to prevent people from messing with it tends to cause physics glitchiness.

They want a perfectly rigid (physically), non-tamperable platform. CFrame and Velocity is the way to go.

I’m pretty new to BodyMovers, how do I move parts without player interrupting it’s movement route? When a player stands on a side, the part will start tilting.
I included a BodyForce which grants it the anti-gravity effect 0, part:GetMass() * workspace.Gravity, 0, a BodyVelocity with Infinite MaxForce, 9999999999 P and a BodyGyro with 999999999999 D and P and infinite MaxTorque.

D is a property that slows it down. Setting it to 99999999999 will probably not work right.

Edit: 999999999 P is also probably not a good idea. 10000 P and 1250 D is normal.

Okay, I will try it! Thans for the tip.