Hi, I’m trying to make a directional dash action. I’ve looked everywhere and most scripts about dashing aren’t directional and only go one way.
I’ve been trying to find a way to detect if a player is going a certain direction and if so, the dash goes the direction they are going to. (Example: Player is moving to the left, he automatically dashes to the left as that is where he is moving.)
I’ve tried Humanoid Direction and CFrame but none seem to work.
Here is an example of what I want to get:
local UIS = game:GetService("UserInputService")
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Debounce = false
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.LeftControl then
if not Debounce then Debounce = true
wait(1)
Debounce = false
else
if -- Code about where the player's direction is going plays the rest of the dash action
local BodyPosition = Instance.new("BodyPosition")
BodyPosition.MaxForce = Vector3.new(1000000,0,1000000)
BodyPosition.P = 100000
BodyPosition.D = 2000
BodyPosition.Position = (HumanoidRootPart.CFrame*CFrame.new(0,0,10)).Position
BodyPosition.Parent = HumanoidRootPart
wait()
BodyPosition:Destroy()
end
end
end)
This isn’t the actual script I made, but something I envision the script would look like.