Hello there. I was wondering about how to make a moving platform for a player using TweenService. I tried searching for a similar post, but could not find one, so I decided to make one myself. When you use TweenService to move a platform, the platform does move, but the player does not move with the platform (you have to move the player manually).
This can be done by using proxies. You can tween a BodyGyro and BodyPosition’s properties to achieve the same effect as tweening the part’s CFrame itself, the responsibility of moving the platform is just handed over to the physics engine, which makes sure to move the player.
By the way, your while true loop could be replaced by modifying the TweenInfo a little:
I don’t know if the last parameter actually delays every time it moves, so you might need to keep your setup.
One last note: You might want to set the part’s network ownership to the server just so the changes to BodyPosition/BodyGyro does not look terrible…
Thank you for your reply. I have read both of those articles, but they do not solve my problem. My question is not how to tween a model, but how would I tween a part and make a player move with the part, while being able to move on the part as well (shown in the second GIF). I do appreciate that you took your time to find the articles and I thank you. I did search for this certain scenario, but could not find any posts.
It works perfectly. The only things needed are adjustments in the BodyPosition’s properties, but other than that, it works perfect, and as it should. Thank you for helping me and answering my problem. Have a wonderful night.
I have same problem
I need that platform and I made BodyPosition and BodyGyro tween but it works only when not anchored so I can’t really make floating moving platforms
(also this exact model from toolbox on second gif don’t work)
if somebody is interested in code:
local TweenService = game:GetService("TweenService")
local tween = TweenService:Create(
script.Parent.BodyPosition,
TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),
{
Position = script.Parent.Parent.End.Position
}
)
local tween1 = TweenService:Create(
script.Parent.BodyPosition,
TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),
{
Position = script.Parent.Parent.Start.Position
}
)
local tween2 = TweenService:Create(
script.Parent.BodyGyro,
TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),
{
CFrame = script.Parent.Parent.Start.CFrame
}
)
local tween3 = TweenService:Create(
script.Parent.BodyGyro,
TweenInfo.new(5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),
{
CFrame = script.Parent.Parent.Start.CFrame
}
)
while true do
tween:Play()
tween2:Play()
wait(5)
tween1:Play()
tween3:Play()
wait(5)
end
I’m Waiting for help because I try it more than two hours now
Edit. I Made it without tweens, using BodyPosition so nvm