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
	if not db then
		db = true
		if con.trailEnabled == true then
			script.Parent.Handle.Trail.Enabled = true
		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
			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
		if slash then
			slash = nil
			humanoid.WalkSpeed = 16
			humanoid.JumpPower = 50
			effect.Enabled = false
			humanoid.AutoRotate = true
		script.Parent.Handle.Trail.Enabled = false
		db = false

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)

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)

function EstusFlaskUsageZ()
	local animator = Char.Humanoid:FindFirstChildOfClass("Animator")
	if CanDrink then
		CanDrink = false
		IsDrinking.Value = true
		IsDrinking.Value = false
		CanDrink = true

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
		local BodyPosition = Instance.new("BodyPosition", Char.HumanoidRootPart)
		local BodyGyro = Instance.new("BodyGyro", Char.HumanoidRootPart)
		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
		Char.Humanoid.AutoRotate = false
		Char.Humanoid.AutoRotate = true
		CanDash = true

--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
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

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.


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.

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.