Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

2 comments

0

I kinda wanna teleport the player instead of launching them forward, though.

0

Oh, then I don't know what to do then because this is technically not dashing.

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

1 comment

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.