Very Smooth Dash System Like Strongest Battlegrounds

I am trying to make a dash system similar to strongest battlegrounds where the dash is changed and determined where your character faces. I’ve tried using both BodyVelocity and LinearVelocity to attempt to make this happen, but the dash doesn’t come out as smooth and responsive as the other game.
I’ve also tried changing the velocity and direction through a while loop, but the dash decides not to turn. I’ve looked through the Devforum, but they didn’t specifically explained how they did it.

Here’s a video on what I have now.

robloxapp-20230911-1840233.wmv (2.1 MB)

Here’s what’s on the Server Script

local function slide(dir, lv,) 
       local thread = coroutine.wrap(function()
		while changeDir do
			wait()
			if dir == "Left" then
				lv.VectorVelocity = char.Torso.CFrame.RightVector * -80
			elseif dir == "Right" then
				lv.VectorVelocity = char.Torso.CFrame.RightVector * 80
			elseif dir == "Forward" then
				lv.VectorVelocity = char.Torso.CFrame.LookVector * 80
			elseif dir == "Backward" then
				lv.VectorVelocity = char.Torso.CFrame.LookVector * -80
			end
		end
	end)
	
	thread()
end

local function dash() 
       if canDash.Value == true then
		canDash.Value = false
		changeDir = true
		
		local attachment = Instance.new("Attachment", char.Torso)
		
		local lv = Instance.new("LinearVelocity", attachment)
		lv.MaxForce = math.huge
		lv.Attachment0 = attachment
		
		if (hum.MoveDirection:Dot(hrp.CFrame.RightVector) > 0.75)  then
			slide("Right", lv, attachment)
		elseif (hum.MoveDirection:Dot(-hrp.CFrame.RightVector) > 0.75) then
			slide("Left", lv, attachment)
		elseif (hum.MoveDirection:Dot(-hrp.CFrame.LookVector) > 0.75) then
			slide("Backward", lv, attachment)
		elseif (hum.MoveDirection:Dot(hrp.CFrame.LookVector) > 0.75) then
			slide("Forward", lv, attachment)
		end
		
		wait(0.3)
		changeDir = false
		lv:Remove()
		attachment:Remove()
		player.PlayerGui["Abilities GUI"]["Dash Button"].TextColor3 = Color3.fromRGB(255, 0, 0)
		for i = 2, 1, -1 do
			player.PlayerGui["Abilities GUI"]["Dash Button"].Text = i.."s"
			wait(1)
		end
		player.PlayerGui["Abilities GUI"]["Dash Button"].Text = "Q / RB"
		player.PlayerGui["Abilities GUI"]["Dash Button"].TextColor3 = Color3.fromRGB(255, 255, 255)
		canDash.Value = true
	end
end

How should a plan to script a very smooth dash system like strongest battlegrounds?

Thank you in Advance.

10 Likes

You could try using tweenservice to tween the velocity to 0 so it doesn’t come to a erupt stop and instead steadily stops.

3 Likes

Although that’s not a bad idea to add that to the dash system, is there a way to make the dash come out smooth and respond very quickly to camera turns?

3 Likes

Using lerp instead of tween service.

3 Likes

How would I be able to use lerp in this situation? Are you saying lerp would replace the LinearVelocity or the tweenservice?

3 Likes

the way game like Strongest Battlegrounds and other games following the battlegrounds format make their game smooth looking is they use a trick to track the camera to the characters head or torso. But this would make the smoothness very dependent on your animation.

4 Likes

I believe you can lerp the velocity to the desired velocity.

for i = 0, 1, 0.1 do
	lv.VectorVelocity = direction * 80 * i
	task.wait(0.1)
end

replace direction with the direction.

3 Likes

The dash still decides to make sharp turns a few milliseconds after the turn of the camera. How do I fix the dash to automatically turn as soon as my camera turns?

2 Likes

I believe TSB handles the dashing movement part in the client instead of the server, it also uses some sort of acceleration system rather than just keeping a constant velocity for a few seconds

1 Like

You should use the line constrain mode.

1 Like

how do I go by setting this up?

1 Like

It’s a property.
LinearVelocity | Documentation - Roblox Creator Hub

2 Likes

Have you found a solution? I am also looking for a way to script a dash system that responds to camera movements.

1 Like

its 100% sure that stb uses linearvelocity

3 Likes

How do you know TSB uses linearvelocity rather than all the other options such as BodyVelocity, BodyPosition, VectorForce etc.

1 Like

The way the solution is executed should not matter. BodyVelocity and BodyPosition are deprecated, and VectorForce would not be very helpful in this scenario where a controlled velocity is intended. LinearVelocity seems quite viable at this stage.

3 Likes

but the problem with linear velocity is that , when u flick ur mouse or something it accelerates

2 Likes

That doesn’t make a lot of sense. Can you explain what you are doing with the LinearVelocity and mouse?

2 Likes

like im setting the linearvelocity normally like setting its attachment0 to an attachment so if i flick it like 90degrees it accelerates for some reason

2 Likes

Why are you rotating the Attachment0 instead of the velocity of the LinearVelocity?

1 Like