I’m trying to make a moving platform with tweenservice that moves players who stand on it. I did this by tweening the bodyposition and bodygyro of the part. The problems I have are that the part always falls down due to gravity and (when I set workspace gravity to zero) the part goes much faster than it should the first time the tween plays. Here is my script:
local mover = script.Parent
local BodyPosition = script.Parent.BodyPosition
local BodyGyro = script.Parent.BodyGyro
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(
4,
Enum.EasingStyle.Sine,
Enum.EasingDirection.InOut,
-1,
true,
0
)
local Goals1 = {
Position = Vector3.new(mover.Position.X + 80, mover.Position.Y, mover.Position.Z)
}
local Goals2 = {
CFrame = CFrame.new(mover.Position.X + 80, mover.Position.Y, mover.Position.Z)
}
local tween1 = TweenService:Create(BodyPosition, tweenInfo, Goals1)
tween1:Play()
local tween2 = TweenService:Create(BodyGyro, tweenInfo, Goals2)
tween2:Play()
Edit: I fixed the gravity issue by adding a BodyForce for the Y axis, but the thing still goes too fast the first time the tween plays.