Problems keeping person on part while using Lerp

I am trying to create a boat where the character does not slide off while it moves, when tweening you can simply parent the character to the boat and they’ll be stable but this doesn’t work for Lerp.

Tween

Lerp

The code for the tween was quite simple too as shown below.

function M:ZoneEntered(player)
	player.Character.Parent = M.Boat
end

function M:ZoneExited(player)
	player.Character.Parent = workspace
end

It’d be very appreciated if I could get some help!!

That is because it is not being affected by Physics. If you want the characters to automatically ‘stick’ to it then you can not use Tweening or any non-physics substitutes without manually matching velocities yourself. I recommend switching to your method to something involving a Physics Object.

The tweening works though? I don’t understand why tween works but Lerp doesn’t. Either way, do you have any solutions to this?

You can use AlignPosition in the ‘OneAttachment’ mode. If you want to handle rotations as well there’s also AlignOrientation. They are very similar in terms of API.

https://developer.roblox.com/en-us/api-reference/class/AlignPosition
https://developer.roblox.com/en-us/api-reference/class/AlignOrientation

This is what I’d recommend learning to use in order to achieve what you’re looking for.

If you have any questions feel free to ask!

1 Like

It didn’t seem to work for me personally this is what I used, no errors either.
kept sliding even after using this.

I have gotten it to work but instead of keeping you on it flings you away??

function M:HandleStick(Player)
	local NewAttachment = Instance.new("Attachment")
	NewAttachment.Parent = Player.Character.HumanoidRootPart
	NewAttachment.Name = Player.Name .. " || AT"
	local NewAllign = Instance.new("AlignPosition")
	NewAllign.Parent = M.Boat.Main
	NewAllign.Name = Player.Name .. " || AL"
	NewAllign.Attachment0 = NewAttachment
end

function M:ZoneEntered(player)
	player.Character.Parent = M.Boat
	M:HandleStick(player)
end

function M:ZoneExited(player)
	player.Character.Parent = workspace
	M.Boat.Main[player.Name .. " || AL"]:Destroy()
	player.Character.HumanoidRootPart[player.Name .. " || AT"]:Destroy()
end

Probably because the parts are anchored. Make sure you unanchor everything and weld it together.