Hello,
I am am trying to make a combat thing and noticed that when a player attacks another player when they are both doing moves that both will land even if one hits the other before. I want to make it where if both do attacks and one hits the other before, then the first person hit would have their move cancelled.
Notes
I know how to detect this, I could just detect when a character’s health changes. I also know how I would stop the attack animation. How would I stop the code running the attack though?
script.Parent.MouseClick:Connect(function(plr)
local char = plr.Character
local function ok()
char.Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
print("return")
return
end)
local i = 0
while true do
i += 1
print(i)
wait(0.05)
end
end
ok()
end)
The loop still goes, how would I make where the return stops the function?