local UserInputService = game:GetService("UserInputService") local Player = game.Players.LocalPlayer local Cooldown = false local Cdtime = 4 UserInputService.InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.Q then if Cooldown then return end spawn(function() Cooldown = true wait(Cdtime) Cooldown = false end) local Root = Player.Character:WaitForChild("HumanoidRootPart") Root.Velocity = Root.Velocity + Vector3.new(80,0,0) end end)
I do that but only works if I face the Z-Axis and messes up. So my question is how do I make the player move right a bit because the way I did it is weird and I can't think of any other way. Any help is appreciated thanks a lot
What you're looking at is starting to get into CFrames. CFrames are basically a mixture of the Position and the Orientation of something. Some of the properties of CFrame are as follows:
CFrame.lookVector CFrame.rightVector CFrame.upVector
In order to move the character a certain direction depending on where they're looking, you need to do something like this.
rootPart.Velocity = rootPart.Velocity + rootPart.CFrame.lookVector*100 -- This makes the velocity of the character's Root Part 100 in the direction it's facing, so it would move the character forward.
If you wanted to move the character left, back, or down, you would do something like this:
rootPart.Velocity = rootPart.Velocity + rootPart.CFrame.rightVector*-100 -- You would just make it times a negative number in the opposite direction.
Hope I helped!