I got movement to work somehow, but i've encountered a few issues

i’m on my journey of creating a custom movement system for my game, and i’ve finally figured out how to get the player to move one direction when i press W, but there’s a few problems that need fixing.

right now, i’m trying to keep it simple. just move forward. it works, but…

  1. My alignposition doesn’t move along the camera’s Y axis
  2. My character doesn’t fall
  3. The AlignPosition eases out when i stop. I’ve tried fixing this with enabling RigidityEnabled but now i can’t control the speed.
  4. After some time, the AlignPosition stops updating for some reason?

my script:

local run_service = game:GetService("RunService")
local userinput_service = game:GetService("UserInputService")

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character.Humanoid
local humanoid_rootpart = character.PrimaryPart
local current_camera = game.Workspace.CurrentCamera

local rootpart_attachment = Instance.new("Attachment")
rootpart_attachment.Parent = humanoid_rootpart
rootpart_attachment.Name = "AlignPositionAttachment"

AlignPos = Instance.new("AlignPosition")
AlignPos.Parent = humanoid_rootpart
AlignPos.Mode = Enum.PositionAlignmentMode.OneAttachment
AlignPos.MaxForce = 10e38
AlignPos.Attachment0 = rootpart_attachment
AlignPos.Position = humanoid_rootpart.Position

local isWalking = false


	if input.KeyCode == Enum.KeyCode.W then
		isWalking = true
		while isWalking == true do
			AlignPos.Position = humanoid_rootpart.Position + Vector3.new(0,0,5)

	isWalking = false

i’ve tried fixing a few of these myself but i can’t figure out how to do it. any help would be appreciated. thanks.

1 Like

As someone who’s attempted custom movement before, ask yourself if you really need custom movement. In one of my own projects, I tried to implement it only for it to turn out very buggy and unstable, and it didn’t even have any advantage over the default movement system.

Now, for your questions:

  1. You need to adjust the direction of the force to where the camera is pointing.
  2. This is because you’re using an AlignPosition. The character is attempting to match the floating part, and is thus floating themselves.
  3. Because you’re updating the target position every frame, this means the character would move at a whopping 300 (60 * 5) studs per second. Consider lowering the offset of the AlignPos.
  4. AlignPositions are jank. If it’s in one-attachment mode, they tend to automatically stop updating.

If you insist on using custom movement, I would reccomend experimenting with bodymovers or impulses that update every frame. Avoid using LinearVelocities, as they react very poorly to obstacles.

1 Like

For the character walking in the wrong direction, check if your HumanoidRootPart is facing right

But like @TheCraftNCreator said, a custom movement is really optional and not needed


hi, sorry for the late reply.

i ended up just building off of the default move system, because my system isn’t that advanced that it needs that kinda stuff.

anyway, just out of curiosity, what bodymover would be better for moving the character than alignposition?

If I could re-attempt my custom movement system, I would try to manually set the velocity of the rootpart instead of using bodymovers.