How do I prevent the player from falling off the part?

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)

This link has helped a lot of people with this specific scenario

Note that there are outdated raycast functions in this, I can help you convert it to new raycasting if needed.

1 Like

Hi,

Doesn’t the player stay on the platform fine, if you have the new player physics enabled?

Seems to…

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.