Im trying to have my character stay on a moving platform, but each time i come close to a wall i bounce off,

what im doing is getting the CFrame of the platform, And each time it changes, change the CFrame of the character accordingly.

It works fine for platform's that are anchored and then the cframe is set, but not for parts with velocity,

Here's the code:

local function UpdateMovingBlock(NewCheck)
	debug.profilebegin("Moving block update")
	
	local NewPosition = NewCheck
	local StandingOnCFrame = StandingOn.CFrame
	
	if StandingOnLastCFrame ~= StandingOnCFrame then
		NewPosition = StandingOnCFrame:toWorldSpace(StandingOnLastCFrame:toObjectSpace(NewCheck))
	end
	
	local StandingOnContinued = Workspace:FindPartOnRayWithIgnoreList(Ray.new(NewPosition.p,Down*10),Ignore) or Workspace.DefaultStandingOnPart
	if StandingOnContinued == StandingOn then
		NewCheck = NewPosition
		HumanoidRootPart.Velocity =  StandingOnCFrame:vectorToWorldSpace(StandingOnLastCFrame:vectorToObjectSpace(HumanoidRootPart.Velocity))
	else
		if UpdateMovingBlockEvent then
			UpdateMovingBlockEvent:disconnect()
		end
		StandingOn = StandingOnContinued
		StandingOnCFrame = StandingOn.CFrame
		UpdateMovingBlockEvent = StandingOn.Changed:connect(function(v)
			if v == "CFrame" then
				HumanoidRootPart.CFrame = UpdateMovingBlock(HumanoidRootPart.CFrame)
			end
		end)
	end
	
	StandingOnLastCFrame = StandingOnCFrame
	debug.profileend()
	return NewCheck
end

Every frame this function gets called with the current CFrame, and returns a new CFrame

Anny idea's on how to make the non-Anchored parts behave the same as the anchored parts?