I want my character to move to what ever direction its HumanoidRootPart is facing
Right now it just moves along the x-axis.
Here is the script I’ve made
local player = game.Players.LocalPlayer
local RunService = game:GetService("RunService")
local ContextActionService = game:GetService("ContextActionService")
local moveValue = 0
local function OnForward(actionName, inputState)
if inputState == Enum.UserInputState.Begin then
moveValue = 1
elseif inputState == Enum.UserInputState.End then
moveValue = 0
end
end
local function move()
if player.Character and player.Character:FindFirstChild("Humanoid") then
player.Character.Humanoid:Move(Vector3.new(moveValue,0,0), false)
end
end
RunService:BindToRenderStep("Control", Enum.RenderPriority.Input.Value, move)
ContextActionService:BindAction("Forward", OnForward, true, "w")
I am not sure if I should use PrimaryPart.CFrame instead and maybe LookVector or something?