Humanoids sliding around

I`m having trouble making my custom rig work with my turn based combat system as it slides around when it tries to attack or goes back to its spot. I want to make it smoothly walk back to its spot but it keeps over shooting or it slides when teleported.

robloxapp-20240110-1408165.wmv (2.8 MB)
This rig isnt part of what Im finally doing but I would like my system to be compatible with any rig I make.
The hip height its height enough to let the rig float, the legs are cancollide false, the parts are all massless.

I looked on the forums for awhile and the closest thing I got to possibly solving the problem is AssemblyLinearVelocity but I dont know if Im lacking information to make it work but it simply didn`t work.

Mini movement function:

function WalkTo(Inter,Player,SPoint,Pad)
	local Poss
	if Inter == 1 then
		local Pos = SPoint.CFrame + (SPoint.CFrame.LookVector * 3)
		Player.Humanoid.WalkSpeed = 20
		Player.Humanoid:MoveTo(Pos.p)
		Player.Humanoid.MoveToFinished:Wait()
		Poss = Pos * CFrame.Angles(0,math.pi,0) + (SPoint.CFrame.LookVector * 1)
	end
	if Inter == 2 then
		Player.Humanoid:MoveTo(Pad.Position + (SPoint.CFrame.LookVector * 1))
		Player.Humanoid.MoveToFinished:Wait()
		Poss = Pad.CFrame
	end
	if Inter == 3 then
		Poss = Pad.CFrame
	end
	if Player.PrimaryPart then
		Player:SetPrimaryPartCFrame(Poss + Vector3.new(0,Player:GetBoundingBox().Y/2,0))
		Player.PrimaryPart.Anchored = true
		local Rwn = coroutine.wrap(function()
			task.wait()
			Player.PrimaryPart:ApplyImpulse(Player.PrimaryPart.AssemblyLinearVelocity * Player.PrimaryPart.AssemblyMass * -1)
			Player.PrimaryPart:ApplyAngularImpulse(Player.PrimaryPart.AssemblyAngularVelocity * Player.PrimaryPart.AssemblyMass * -1)-- according to the devforum these line would halt all movement	but it doesn`t		
			Player.PrimaryPart.Anchored = false
		end)
		Rwn()
	end
end
1 Like