I have a dash script that is supposed to teleport the player 10 studs ahead of themselves, but it ends up just teleporting the player to a position completely unrelated.
Here is my code:
(This code only includes the part with the problem)
1 | local function Dash() |
2 | Moving.Value = true |
3 | print ( "Dash Foward" ) |
4 | HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.CFrame.lookVector) * CFrame.new( 0 , 0 , - 10 ) |
5 | wait( 0.3 ) |
6 | Moving.Value = false |
7 | end |
Here try this:
1 | -- Put this on Line 4 |
2 | HumanoidRootPart.Velocity = HumanoidRootPart.CFrame.lookVector * 300 -- Change this number to what ever you want |
If it doesn't work dm me on discord, supernova#0034
If you multiply a CFrame the position will be relative
1 | local function Dash() |
2 | Moving.Value = true |
3 | print ( "Dash Foward" ) |
4 | HumanoidRootPart.CFrame = HumanoidRootPart.CFrame * CFrame.new( 0 , 0 ,- 10 ) |
5 | wait( 0.3 ) |
6 | Moving.Value = false |
7 | end |