I want to make a script that when you press x, your character automatically runs in the direction its facing. I've tried all sorts of things and I can't figure it out. Does anyone know how to do this? (sorry for my bad grammar, I couldn't think of another way to explain it)
here:
1 | --first the when x is pressed then |
2 | local h = game.Players.LocalPlayer.Character.Humanoid |
3 | if h~ = nil then |
4 |
5 | h.Torso.CFrame = CFrame.new( 0 , 0 , 0 ) -- Place A Position Here, You can put (players Position) + (100,0,0) |
1 | local plr = game.Players.LocalPlayer |
2 | game:GetService( "UserInputService" ).InputBegan:Connect( function (key,isTyping) |
3 | if isTyping = = false and key.KeyCode = = Enum.KeyCode.X then |
4 | local movePosition = plr.Character.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new( 0 , 0 ,- 100 ).p |
5 | plr.Character:WaitForChild( "Humanoid" ):MoveTo(movePosition) |
6 | end |
7 | end ) |