How do i change the direction a person walks?

so i made a animation for a sword ( dont judge it, I’m learning), and i want the character to walk the way the sword and head is pointing but i don’t know how to do that, anyone know how?

1 Like

Like walk normally, or as from the picture to the right,

But if you move right with the head of the sword, the sword will rotate with the body, so you will keep going in circles, except if you want when u press w it makes it so u walk where the sword is pointed

1 Like

i want it to walk where the sword is pointed when pressing w

1 Like

I’m not smart enough to think one part out so, for now i think you should make an invisible part at the end of your tool

-- Local script

local UserInputService = game:GetService("UserInputService")

controls = require(player.PlayerScripts:WaitForChild("PlayerModule")):GetControls()

local player = game.Players.LocalPlayer
local character = player.Character

local endPart = script.Parent.EndPart -- the tip of your sword aka where you wanna move to
local tool = script.Parent

local equipped = false

tool.Equipped:Connect(function()
    controls:Disable()
    equipped = true
end)

tool.Unequipped:Connect(function()
    controls:Enable()
    equipped = false
end)

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
    if input.KeyCode == Enum.KeyCode.W then
        if equipped == true then
            character:Move(endPart.Position, false)
        end   
    end
end)

I haven’t tested this out, but if there are bugs just tell me

1 Like

where do i put this script lol?

1 Like

Oh i have an idea, put the script in the tool and the end part in the tool aswell so it’s easier to the coding

like
local tool = script.Parent
local endPart = script.Parent.endPart

first problem:
Screenshot (196)

did you assign the tool?

? i have no idea how to script so i dont know what that means

Oh my bad just add another “)” at the end of tool.Equipped and Unequipped aswell

like where it says end

I updated the script above, try it now

its not working…

30charrrrrrrrrrrrrrrs

give me a sec, ill try to replicate the game in my studio ;/

1 Like

i have to go now, but if you could try and work it out that would be great thank you!

1 Like