I want to make the part tween smoothly and make it so the player doesn’t fall off.
The player falls off the part and the tween isn’t smooth.
I’ve tried almost everything but I still can’t figure out a solution.
script
local TweenService = game:GetService('TweenService')
local part = script.Parent
local TweenInfoo = TweenInfo.new(
10,
Enum.EasingStyle.Quad,
Enum.EasingDirection.In,
-1,
true,
0
)
local goal = {CFrame = CFrame.new(-2.395, 14.541, 13.507) * CFrame.Angles(0, math.rad(-90),(0))} --
local Tween = TweenService:Create(part,TweenInfoo,goal)
Tween:Play()
local part = workspace:WaitForChild("Union")
local RunService = game:GetService("RunService")
local lastposition = part.Position
local lastOriention = part.Orientation
RunService.Heartbeat:Connect(function(deltaTime)
local currentPosition = part.Position
local deltaposition = currentPosition - lastposition
local currentOrientation = part.Orientation
local deltaOrientation = currentOrientation - lastOriention
local velocity = deltaposition / deltaTime
part.AssemblyLinearVelocity = velocity
local velocity = deltaOrientation
part.AssemblyAngularVelocity = velocity
lastposition = currentPosition
lastOriention = currentOrientation
end)