Tool is dealing no damage

I have two scripts, a local script that fires a remote event when the player uses the tool and a script that makes the player take damage. I’ve been working on it for like an hour now, first it was dealing no damage, then it dealt damage without a cooldown and without clicking.
On my previous attempt I got very close, the tool was just dealing damage long after the player used it, right now it’s dealing no damage and I don’t know why. I’ll give the most recent version as well as the one that had the best results.

Local script (the same on both versions):

tool.Activated:Connect(function() 
	if CanSwipe == true then 
		CanSwipe = false 
		
		papa.Swipe:FireServer(CanSwipe)
		
		IsDmging.Value = true

		local anim = Humanoid:LoadAnimation(swipe) 
		anim:Play()
		
		wait(0.25)
		IsDmging.Value = false
		
		wait(0.75)
		CanSwipe = true
		
	end
end)

Script (also current):

script.Parent.Swipe.OnServerEvent:Connect(function(plr, CanSwipe)
	script.Parent.SwipeHitbox.Touched:Connect(function(hit)
		local hooman = hit.Parent:FindFirstChild("Humanoid")

		if hooman and script.Parent.IsDamaging.Value == true then
			hooman:TakeDamage(35)
			script.Parent.IsDamaging.Value = false
		end
	end)
end)

Script (previous one):

script.Parent.Swipe.OnServerEvent:Connect(function(plr, CanSwipe)
	script.Parent.SwipeHitbox.Touched:Connect(function(hit)
		local hooman = hit.Parent:FindFirstChild("Humanoid")

		if hooman and CanSwipe == false then
			hooman:TakeDamage(35)
			print(hooman.Name.. " took damage")
			script.Parent.IsDamaging.Value = true
			CanSwipe = true
		end
	end)
end)

Could the problem be that you set the IsDamaging to true in the local script. Because that is done in a local script, the Server cannot see it, so it never deals damage. There are some other problems with this script, every time you fire the server, another touched event connection will be made, so the damage will start stacking over time. I would suggest watching this Video, I found it very helpful:

3 Likes

im not sure but you might of messed something up not fully sure tho

it’s because you can’t disable/un-disable a server script from a local script. You need to use a remote event or something.