How to make a dash system?

I’m trying to create a dash system for an r6 combat game, like in the game ‘The Strongest Battlegrounds’.
I’m not really an expert when it comes to roblox physics and velocitys, so I don’t really have any idea of how to do it. Though, I have looked around on the developer forum for some sort of guidance, but most of the solutions are using BodyVelocity, which is deprecated.

Appreciates help.

1 Like

Just because something is deprecated doesn’t mean it’s unusable

BodyVelocity, BodyPosition, and BodyGyro are deprecated, yet are still the most viable option when making movement systems

That being said, for dashes I use a BodyVelocity with these settings:

image

…where MoveSettings.Dash_Velocity is 100, and DashDirection is the .MoveDirection of the humanoid

2 Likes

why dont you use tween with position for dashes if you dont want to use bodyvelocity

yes tween works surprisingly well for dashes i never knew until i decided to test it

but the problem is when player trying to change direction while dashing (still can be editted by move direction but it will get complicated)

Could you give me an example script?

1 Like

The following script will make the player dash whenever they press Q on the keyboard or L1 on their controller

image
image

--- input template

local UIS			= game:GetService("UserInputService")
local Player		= game:GetService("Players").LocalPlayer
local Character		= Player.Character or Player.CharacterAdded:Wait()
local RootPart		= Character:WaitForChild("HumanoidRootPart")
local Humanoid		= Character:WaitForChild("Humanoid") :: Humanoid

local Camera		= workspace.CurrentCamera

local BV			= script.BodyVelocity

local Settings		= {
	Lifetime			= 0.12;
	DashVelocity		= 100;
	Cooldown			= 1;
}

local Keycodes = {
	[Enum.KeyCode.Q] = true;
	[Enum.KeyCode.ButtonL1] = true;
}

local function f()
	local Now = workspace:GetServerTimeNow()
	local DashCooldown = Character:GetAttribute("DashCooldown") or 0
	if DashCooldown > Now then return end
	Character:SetAttribute("DashCooldown", Now + Settings.Cooldown)

	local NewBV = BV:Clone()

	local Direction = Humanoid.MoveDirection
	if Direction.Magnitude == 0 then
		Direction = RootPart.CFrame.LookVector
	end
	local CamP0 = Camera.CFrame.LookVector
	local RelativeDirection = CFrame.lookAt(CamP0, CamP0 + Direction).LookVector

	NewBV.Velocity = RelativeDirection * Settings.DashVelocity
	NewBV.Parent = RootPart
	
	task.delay(0.12, function()
		NewBV:Destroy()
	end)
end

UIS.InputBegan:Connect(function(InputObject: InputObject, SunkInput: boolean)
	if SunkInput then return end
	if not Keycodes[InputObject.KeyCode] then return end
	
	f()
end)
1 Like

How would I add animation to this dash?

I do know how to use animations, what I’m wondering is how I would add them into the dash, ‘FrontDash’, ‘BackDash’ etc.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.