Local script got delayed on server script!

1. What do you want to achieve?
Okay, i have this dash system in local script at StarterCharacteeScript and a tool in ReplicatedStorage with a server script with handle made with a union and a additional hitbox part.

2. What is the issue?
The issue happen when you decide to perform the tool attack and the dash in order and faster
I just don’t know how to stop one of these script while the other is doing the action.

3. What solutions have you tried so far?
Well… Debounce, bool value and disabling the local script.
I keept debounce and the bool value cause they make the code a bit understandable.

Actually the boolvalue seems to have fixed the opposite situation using manualactivationonly.
I don’t know this issue look like a sort of delay and my game has a lot of parts/unions. I tried on an empty place and is still the same.
I don’t think is a server/connection fault.
Inside the local script there is also a non-tool heal system that replicate and cframe a model in replicatedstorage to the character and works the same as the dash for the exception that is not a dash.
Even the heal key has the same issue as the dash when dealing with the tool script.

The server script’s tool(slash function):

--Sword Slash
script.Parent.Activated:Connect(function()
	if not db then
		db = true
		if con.trailEnabled == true then
			script.Parent.Handle.Trail.Enabled = true
		end
		local Dash = script.Parent.Parent:WaitForChild("Dash")
		local Value = Dash:FindFirstChildOfClass("BoolValue")
		local humanoid = script.Parent.Parent:WaitForChild("Humanoid")
		local animator = humanoid:FindFirstChildOfClass("Animator")
		local hrp = script.Parent.Parent:WaitForChild("HumanoidRootPart")
		local BodyVelocity = Instance.new("BodyVelocity")
		local BodyGyro = Instance.new("BodyGyro")
		local effect = script.Parent.Handle.Spark
		if not slash then
			if randomSlash == 1 and Value.Value == false then
				slash = animator:LoadAnimation(script.Slash1)
				randomSlash = randomSlash + 1
				humanoid.WalkSpeed = 8
				humanoid.JumpPower = 0
				delay(1.5, function()
					if randomSlash == 2 then
						randomSlash = 1
					end
				end)
			elseif randomSlash == 2 and Value.Value == false then
				BodyVelocity.Parent = script.Parent.Parent:WaitForChild("HumanoidRootPart")
				BodyGyro.Parent = script.Parent.Parent:WaitForChild("HumanoidRootPart")
				humanoid.AutoRotate = false
				slash = animator:LoadAnimation(script.Slash2)
				randomSlash = randomSlash - 1
				humanoid.WalkSpeed = 8
				humanoid.JumpPower = 0
				effect.Enabled = true
				BodyVelocity.MaxForce = Vector3.new(100000, 0, 100000)
				BodyVelocity.P = 100000
				BodyVelocity.Velocity = hrp.CFrame.LookVector * Vector3.new(30, 0, 30)
				BodyGyro.MaxTorque = Vector3.new(400000,400000,400000)
				BodyGyro.CFrame = hrp.CFrame
			end
		end
		slash:Play()
		wait(0.4)
		script.Parent.Handle.Slash:Play()
		wait(0.75)
		if slash then
			slash:Stop()
			slash = nil
			humanoid.WalkSpeed = 16
			humanoid.JumpPower = 50
			effect.Enabled = false
			humanoid.AutoRotate = true
			BodyVelocity:Destroy()
			BodyGyro:Destroy()
		end
		script.Parent.Handle.Trail.Enabled = false
		db = false
	end
end)

the dash:

function ToolDetect()
	for _, tool in pairs(Char:GetChildren()) do
		if tool:IsA("Tool") then
			tool.ManualActivationOnly = true
			IsDashing.Value = true
			print(tool.ManualActivationOnly, IsDashing.Value)
		end
	end
end

function ToolDetected()
	for _, tool in pairs(Char:GetChildren()) do
		if tool:IsA("Tool") then
			tool.ManualActivationOnly = false
			IsDashing.Value = false
			print(tool.ManualActivationOnly, IsDashing.Value)
		end
	end
end

function EstusFlaskUsageZ()
	local animator = Char.Humanoid:FindFirstChildOfClass("Animator")
	if CanDrink then
		CanDrink = false
		IsDrinking.Value = true
		ToolDetect()
		game.ReplicatedStorage:WaitForChild("EstusDrinkEvent"):FireServer()
		animator:LoadAnimation(script.EstusDrinkAnim):Play()
		script.EstusDrink:Play()
		task.wait(1)
		IsDrinking.Value = false
		task.wait(CoolDownEstus)
		CanDrink = true
	end
end

function velocityFunctionW()
	local animator = Char.Humanoid:FindFirstChildOfClass("Animator")
	if CanDash and Char.Humanoid.MoveDirection ~= Vector3.new(0, 0, 0) and IsDrinking.Value == false then
		CanDash = false
		ToolDetect()
		local BodyPosition = Instance.new("BodyPosition", Char.HumanoidRootPart)
		local BodyGyro = Instance.new("BodyGyro", Char.HumanoidRootPart)
		game.ReplicatedStorage.ForceFieldEvent:FireServer()
		BodyPosition.MaxForce = Vector3.new(14000, 0, 14000)
		BodyPosition.P = 14000
		BodyPosition.D = 2000
		BodyPosition.Position = (Char.HumanoidRootPart.CFrame * Vector3.new(0, 0, -30))
		BodyPosition.Parent = Char.HumanoidRootPart
		BodyGyro.MaxTorque = Vector3.new(400000,400000,400000)
		BodyGyro.CFrame = Char.HumanoidRootPart.CFrame
		animator:LoadAnimation(script.DashW):Play()
		script.DashSound:Play()
		Char.Humanoid.AutoRotate = false
		task.wait(1)
		ToolDetected()
		BodyPosition:Destroy()
		BodyGyro:Destroy()
		Char.Humanoid.AutoRotate = true
		task.wait(CoolDown)
		CanDash = true
	end
end

--bla bla bla (the script has even keybind for lateral dashes and mobile support with shiftlock but its not important now)

game:GetService("UserInputService").InputBegan:Connect(function(key, gameprocessed)
	if gameprocessed then return end
	if not IsDashing then return end
	if not IsDrinking then return end
	if key.KeyCode == KeyCodeQ and UIS:IsKeyDown(KeyCodeW) then
		velocityFunctionW()
	end
end)
game:GetService("UserInputService").InputBegan:Connect(function(key, gameprocessed)
	if gameprocessed then return end
	if not IsDashing then return end
	if not IsDrinking then return end
	if key.KeyCode == KeyCodeZ then
		EstusFlaskUsageZ()
	end
end)

I’m really sorry for the wall text also for the bad english.

Task.wait will do same. Or something delaying at client side.

And maybe conflicts happening in bla bla bla.

Basically in bla bla bla i wrote the same code but with differents dir like right left back and one with mobile thats the reason why i didn’t added them.
I tried task wait on client and server but the issue
still there. Might be a sort of conflict as you said before?

Maybe do: wait()

What is wait() ?

wait() Is something that directly does something like closing the frame.

Example:

wait() -- it's optional because it's a "timer limiter" or you can shorten the script to "script.Parent.Parent.Visible = false" so like it's just only 1 line.
script.Parent.Parent.Visible = false -- invisible because of this: script.Parent.Parent.Visible = false

So it’s 0 seconds.

I don’t think its the case.
The server script comunicate with the local script.
So for example in the server one i want to disable the local script when the tool is activated.
The local script take less than an half of a second before the action.
But during this delay people can still dash making a total conflict from both scripts.

Now this came in my thought.
How strong your network is?

Ok i did a network test and i got 34mbps is that a good thing for roblox?
I have 9ms latency.

About what you asked i heard some ways around the devs forum to hide network latency via scripts but it might be a pure nightmare.
It must be a better way that people use more for this type of combat system with tools.
I need to know how people manage to perform attacks using tools but once they get in the state
of attacking they become unable of interacting with mechanics like dash or healing.

wait(.5)--Loading
Player.Data.["Bla Bla"].Value = math.random(999)--After Loading

Bla bla bla is basically the rest of the script.
They are the same functions like the one i wrote in the post(the local script).
Its all a local script except for the sword script(server script) located inside the tool.
I didnt put here because are the basically the same.

I don’t think the latency is the reason of this issue.
I might have proof:
Simply during my tests i did the attack and the dash in this order really fast to see if it work.
I was using the local script disable and suddenly the local script broke.
For broke i mean the local script got disabled when it was still running causing the no-destruction of the body position(main instance of the dash script).
What i’m trying to explain is it might actually be a “coordination” problem between those scripts.
And here i really don’t know what to do, where i should check this is why i’m asking so hard help here.