Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I move the player toward the direction they are facing without BodyVelocity?

Asked by
DemGame 271 Moderation Voter
4 years ago

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)


local function Dash() Moving.Value = true print("Dash Foward") HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.CFrame.lookVector) * CFrame.new(0, 0, -10) wait(0.3) Moving.Value = false end

2 answers

Log in to vote
0
Answered by 4 years ago

Here try this:

-- Put this on Line 4
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

0
I kinda wanna teleport the player instead of launching them forward, though. DemGame 271 — 4y
0
Oh, then I don't know what to do then because this is technically not dashing. coreyhsGames 5 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

If you multiply a CFrame the position will be relative

local function Dash()
    Moving.Value = true
    print("Dash Foward")
    HumanoidRootPart.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,0,-10)
    wait(0.3)
    Moving.Value = false
end

0
This still does not move the player in terms of making them actually move toward the desired point. This code will just teleport them to the location, and this does not entirely answer their question. DeceptiveCaster 3761 — 4y

Answer this question