Using humanoid:Move destroys player's body parts

Hello devs! I’m working on a movement system that replicates the feel of Source Engine’s movement, I’m using humanoid:Move to move the player in a direction, but here’s the problem, when I try to use it, it just causes the body parts to get destroyed and I don’t know why, here’s my code (it’s still WIP):

runService.RenderStepped:Connect(function(dTime)
	local movementDirection = getMovementDirection()
	movementDirection = camera.CFrame:VectorToWorldSpace(movementDirection)
	movementDirection = Vector3.new(movementDirection.X,0,movementDirection.Z)
	humanoid:Move(movementDirection,false)
end)

are you able to provide getMovementDirection()?

local function getMovementDirection()
	local direction = Vector3.new()
	if movementInputs.forward == true then
		direction -= Vector3.new(0,0,1)
	end
	if movementInputs.backward == true then
		direction += Vector3.new(0,0,1)
	end
	if movementInputs.left == true then
		direction -= Vector3.new(1,0,0)
	end
	if movementInputs.right == true then
		direction += Vector3.new(1,0,0)
	end
	return direction.Unit
end

Nevermind, fixed it by having a variable called movementDirection which is an empty Vector3 and changed the previous variable to movementVelocity, then checked if magnitude of movementVelocity was above 0 and then set movementDirection to movementVelocity and applied the camera rotation stuff, now it works.

1 Like

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