game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0
player = game.Players.LocalPlayer
hum = player.Character
--[[function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.W then
hum.Torso.Position = hum.Torso.Position + Vector3.new(0,0,5)
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)--]]
function onKeyPress(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.W then
hum.Torso.CFrame = hum.Torso.CFrame + CFrame.new(0,0,5)
end
end
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
the commented part is the vector3 one that didnt have any errors, but detached me torso from the character. i wanted to use CFrame because i want the rest of the player to move with the body.

4 comments
CFrame.new requires a Vector3 value for its first argument. All you have to do is put 0,0,5 into a Vector3 value.
i did, and nothing.
Also, CFrame is a matrix essentially. You can't add them, but you can multiply them.
thank you