How am i supposed to move the player with alignposition?

i’m trying to figure out how you’re supposed to make a custom movement system, but i came across using bodymovers to move the player, but how you’re supposed to do that is beyond me.

but whenever i find something about alignposition or something on youtube it’s always saying to attach it to another part, which kinda doesn’t make sense considering all i’m trying to do is make my character move with WASD. and why would i do that by using another part?

Here’s how to move a player with AlignPosition:

  1. add an Attachment to the player’s HumanoidRootPart
  2. add an AlignPosition to the player’s HumanoidRootPart
  3. set AlignPosition Mode property to OneAttachment
  4. set AlignPosition Attachment0 property to the Attachment you added
  5. adjust AlignPosition MaxForce, MaxVelocity and Responsiveness properties so AlignPosition behaves the way you want it to
  6. and then you can set the Position property of AlignPosition to the position you want to move the player to
1 Like

As @denkodin said, this can look something like this when made into a function:

local function movePlayer(player: Player, destination: Vector3)
    local Character = player.Character or player.CharacterAdded:Wait()

    local HRPAttachment = Instance.new("Attachment")
    HRPAttachment.Parent = Character.PrimaryPart

    local AlignPos = Instance.new("AlignPosition")
    AlignPos.Parent = Character.PrimaryPart
    AlignPos.Mode = Enum.PositionAlignmentMode.OneAttachment
    AlignPos.MaxForce = Vector3.one * 10e38
    AlignPos.Attachment0 = HRPAttachment
    AlignPos.Position = destination
end

*NOTE: Not tested, may not work

so would i just set the destination to somewhere around the player depending on which key is pressed?