Dash looks choppy and mid [STILL NEED HELP]

Hello! I am working on a battlegrounds game, and the dash is very choppy and slow compared to other games I’ve played.
this is what the dash looks like:

External Media

Here’s the script for the front dash:

local remote = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("Dash")
local runserv = game["Run Service"]
remote.OnServerEvent:Connect(function(plr, dir)
	local char = plr.Character
	if char:GetAttribute("M1") == true then return end
	local hum = char.Humanoid
	local hrp = char.HumanoidRootPart
	local lv = Instance.new("LinearVelocity")
	local att = Instance.new("Attachment")
	lv.Parent = att
	att.Parent = hrp
	lv.Attachment0 = att
	lv.ForceLimitMode = Enum.ForceLimitMode.PerAxis
	lv.MaxAxesForce = Vector3.new(math.huge,0,math.huge)
	local tatt0 = Instance.new("Attachment")
	tatt0.Parent = hrp
	local tatt1 = Instance.new("Attachment")
	tatt1.Parent = hrp
	tatt1.Position = tatt0.Position +Vector3.new(0,3,0)
	local trail = Instance.new("Trail")

	trail.Parent = hrp
	trail.Attachment0 = tatt0
	trail.Attachment1 = tatt1
	trail.Transparency = NumberSequence.new(0.5)
	trail.Lifetime = 0.5
	
	local anim

	if dir == "Forward" then
		anim = char.Humanoid:LoadAnimation(script.Foward)
		local con = runserv.Stepped:Connect(function()
			if char.Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
				lv.VectorVelocity = Vector3.new(0,-25,0) + hrp.CFrame.LookVector * 40

			else
				lv.VectorVelocity =hrp.CFrame.LookVector * 40
			end
			
		end)
		
		anim:Play()
		hum.WalkSpeed = 0
		hum.JumpPower = 0
		local hitbox = game.ServerStorage.Models.DashHitbox:Clone()
		hitbox.CanCollide = false
		hitbox.Anchored = false
		hitbox.Parent = workspace
		hitbox.Transparency = 1
		hitbox.CFrame = char.HumanoidRootPart.CFrame + char.HumanoidRootPart.CFrame.LookVector * 5
		local weldcon = Instance.new("WeldConstraint")
		
		weldcon.Parent = hrp
		weldcon.Part0 = hrp
		weldcon.Part1 = hitbox
		local cantdam = {}
	
		anim:GetMarkerReachedSignal("Hit"):Connect(function()
			hitbox.Touched:Connect(function(hit)
				if hit.Parent.Humanoid then
					if hit.Parent.Name ~= char.Name then
						if hit.Parent:GetAttribute("Blocking") == true then return end
						if hit.Parent.Rag.Value == true then return end
						if table.find(cantdam, hit.Parent.Name) then return end
						table.insert(cantdam, hit.Parent.Name)
						lv:Destroy()
						att:Destroy()

						hit.Parent.Humanoid:TakeDamage(2)
						wait(2)
						table.remove(cantdam, table.find(cantdam, hit.Parent))
					end
				end
			end)
		end)
		
		game.Debris:AddItem(lv, 1)
		game.Debris:AddItem(trail,1)
		game.Debris:AddItem(hitbox, 1.2)
		wait(1)
		att:Destroy()
		con:Disconnect()
		hum.WalkSpeed = 16
		hum.JumpPower = 50
2 Likes

Post in the code review category Code Review - Developer Forum | Roblox if you seek to improve already working code.

It isn’t working how it is supposed to though.

bump because I still need help. Also, I updated the script but it’s still choppy:

local remote = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("Dash")
local runserv = game["Run Service"]
remote.OnServerEvent:Connect(function(plr, dir)
	local char = plr.Character
	if char:GetAttribute("M1") == true then return end
	local hum = char.Humanoid
	local hrp = char.HumanoidRootPart
	local lv = Instance.new("LinearVelocity")
	local att = Instance.new("Attachment")
	lv.Parent = att
	att.Parent = hrp
	lv.Attachment0 = att
	lv.ForceLimitMode = Enum.ForceLimitMode.PerAxis
	lv.MaxAxesForce = Vector3.new(math.huge,50,math.huge)
	local tatt0 = Instance.new("Attachment")
	tatt0.Parent = hrp
	local tatt1 = Instance.new("Attachment")
	tatt1.Parent = hrp
	tatt1.Position = tatt0.Position +Vector3.new(0,3,0)
	local trail = Instance.new("Trail")

	trail.Parent = hrp
	trail.Attachment0 = tatt0
	trail.Attachment1 = tatt1
	trail.Transparency = NumberSequence.new(0.5)
	trail.Lifetime = 0.5
	
	local anim

	if dir == "Forward" then
		anim = char.Humanoid:LoadAnimation(script.Foward)
		game.Debris:AddItem(att, 0.7)
		game.Debris:AddItem(trail,0.7)
		

		anim:Play()
		hum.WalkSpeed = 0
		hum.JumpPower = 0
		local hitbox = game.ServerStorage.Models.DashHitbox:Clone()
		hitbox.CanCollide = false
		hitbox.Anchored = false
		hitbox.Parent = workspace
		hitbox.Transparency = 0.5
		hitbox.CFrame = char.HumanoidRootPart.CFrame + char.HumanoidRootPart.CFrame.LookVector * 5
		local weldcon = Instance.new("WeldConstraint")
		
		weldcon.Parent = hrp
		weldcon.Part0 = hrp
		weldcon.Part1 = hitbox
		local cantdam = {}
		game.Debris:AddItem(hitbox, 1.1)
		anim:GetMarkerReachedSignal("Hit"):Connect(function()
			print("signal")
			hitbox.Touched:Connect(function(hit)
				if hit.Parent.Humanoid then
					if hit.Parent.Name ~= char.Name then
						if hit.Parent:GetAttribute("Blocking") == true then return end
						if hit.Parent.Rag.Value == true then return end
						print("hitbox")
						if table.find(cantdam, hit.Parent.Name) then return end
						table.insert(cantdam, hit.Parent.Name)
						lv:Destroy()
						att:Destroy()

						hit.Parent.Humanoid:TakeDamage(2)
						wait(2)
						table.remove(cantdam, table.find(cantdam, hit.Parent))
					end
				end
			end)
		end)
		local i = 0
		repeat 
			if char.Humanoid:GetState() == Enum.HumanoidStateType.Freefall then
				lv.VectorVelocity = Vector3.new(0,-25,0) + hrp.CFrame.LookVector * 40

			else
				lv.VectorVelocity =hrp.CFrame.LookVector * 40
			end
		task.wait(0.001)
			i+=1
			print(i)
		until i == 50
		
		
		print('reached')
		
	
	
		hum.WalkSpeed = 16
		hum.JumpPower = 50

bumps someone pls helpppppppppppppppppppppppppppppppp

I guess I’m not gonna get help :confused: oh well

I think the delay between the punch along with the amount of time in the dash just makes it look/feel slow. idk tho

1 Like

I tried speeding it up and it still doesn’t feel very smooth

Did you speed up the amount of time the animation takes or the time between the punches?

I ended up just slowing down the dash every loop and it looks a lot smoother. thanks for the help, though. It doesn’t look as good as the games I’ve seen, but it will do for now.

1 Like

alright, good luck with the game!

1 Like