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)