How Tween Character without going through the part(advance scripted needed)

This is it is right now without tween and I want to tween this without and this is the line that makes the character go to the position
https://streamable.com/xnmkhu

						local Orgin = Head.Position + (HRP.CFrame.LookVector * 5).magnitude * (HRP.CFrame.LookVector *  5).Unit
						local RaycastResults10 = workspace:Raycast(Orgin, -HRP.CFrame.RightVector * 1,  raycastParams)

							if RaycastResults10 then
								Hum.PlatformStand = false
								HRP.ClimbVelocity.Velocity = Vector3.new(0,0,0)
								local hit10 = RaycastResults10.Instance
								local pos10 = RaycastResults10.Position
								local Normal10 = RaycastResults10.Normal
								HRP.CFrame = CFrame.new(pos10,Vector3.new(HRP.Position.X - Normal10.x,HRP.Position.Y,HRP.Position.Z - Normal10.z)) 
								HRP.BodyGyro.CFrame = CFrame.new(pos10,Vector3.new(HRP.Position.X - Normal10.x,HRP.Position.Y,HRP.Position.Z - Normal10.z))
								wait(0.2)HRP.Velocity = Vector3.new(0,0,0)
								Hum.PlatformStand = true
							end

I hope I have understood your question right.

You want to tween the character so it moves between walls but without it going inside of the wall, correct?

If that’s the case, I suggest you tween its Z position then it’s X position, this way it’ll look like he’s moving sideways. If you just try to tween his total Position, he’ll end up going through the wall since it’ll generate a diagonal line between where you are to where you want to go.

If you tween the Z-axis and then the X-axis, or in the order that fits you best, you’ll move in straight lines around the wall.

1 Like