#How to move the Player in Its facing direction?

1 messages · Page 1 of 1 (latest)

tidal latch
#

How can i move the player without moving it in the direction The camera's facing?

red orchid
#

prob changing HumanoidRootPart's cframe

#

with lookvector

tidal latch
#

no

red orchid
#

oh cameras

#

uhhh

tidal latch
#

like when you move

#

it moves in the directon of the camera

#

how do i make it move in the direction the player's facing

red orchid
#

uh

#

no idea unless u just use runservice and camera type scriptable

#

to just keep updating it

tidal latch
# red orchid no idea unless u just use runservice and camera type scriptable

I have this script but the controls are inversed

RunService:BindToRenderStep("TankMovement", Enum.RenderPriority.Character.Value + 1, function()
            local character = player.Character
            if character then
                local humanoid = character:FindFirstChild("Humanoid")
                local hrp = character:FindFirstChild("HumanoidRootPart")

                if humanoid and hrp then
                    local input = Controls:GetMoveVector()
                    if input.Magnitude > 0 then
                        -- Just pass the local vector, and useCameraRelative = true means HRP-relative
                        humanoid:Move(input, false)
                    else
                        humanoid:Move(Vector3.zero, false)
                    end
                end
            end
        end)
red orchid
tidal latch
#

like this kinda

red orchid
#

is that what u want

#

i cant explain well

#

but uh

#

u could try smth with .LookAt

#

of Cframe

tidal latch
#

kinda but you can still move the camera with shiftLock

red orchid
#

to get where its looking

red orchid
#

and

tidal latch
#

in the vid it works its just inversed

red orchid
#

when W, just hum:MoveTo to LookAt*2

#

ohhh

#

i see

tidal latch
#
RunService:BindToRenderStep("TankMovement", Enum.RenderPriority.Character.Value + 1, function()
            local character = player.Character
            if character then
                local humanoid = character:FindFirstChild("Humanoid")
                local hrp = character:FindFirstChild("HumanoidRootPart")

                if humanoid and hrp then
                    local input = Controls:GetMoveVector()
                    if input.Magnitude > 0 then
                        -- Just pass the local vector, and useCameraRelative = true means HRP-relative
                        humanoid:Move(input, false)
                    else
                        humanoid:Move(Vector3.zero, false)
                    end
                end
            end
        end)
red orchid
#

is just A and D swapped?

#

or all

tidal latch
#

all

red orchid
#

same with others

#

that should workkkk rightt

#

or am slow

tidal latch
#

hol up

#

what i did was change :Move(input) and put a - before input, but its going in the worlds direction

#

But

#

i dont think it would work otherwise

tidal latch
#

since it doesnt change the player's rotation

red orchid
tidal latch
red orchid
tidal latch
red orchid
#

i see

tidal latch
#

kinda complicated

red orchid
#

maybe my first idea wouldnt be that bad

#

to

#

disable WASD functionality

#

and

#

if pressed W

#

then move in humanoidrootpart.CFrame.LookAt

tidal latch
#

so it just spins the player

red orchid
tidal latch
#

since when you press D or A it changes orientation, it will change the humanoidRPart's rightvector and cause it to spin

#

one way i can think of is set the rightVector/Lookvector before the moving

red orchid
#

cant u just make it look forward and just move in correct direction

#

so always looks one direction

tidal latch
#

well its not a 2d game

#

i dont care abt it turning only moving left and right

red orchid
#

make it always look in specific direction

#

And W moves forward (based on lookvector)

#

S backwards again with lookvector

#

and A/D dont turn it, but make him move left/right

#

if u get what i mean

tidal latch
#

so like shiftLock?

red orchid
#

yeeee

#

just remembered how shiftworks work

#

tbf

#

💔

tidal latch
#

ill ask coding bacon abt it

#

thx

idle scaffold
#

probably will also fix the problem with rotating when your press w