Hello, I am developing a fighting game and I am making an ability where the player sends consecutive slashes with a sword. How can I make it so, let’s say for example, each 0.5s the touched event activates and hurts the player touching the sword?
local overlapParams = OverlapParams.new()
overlapParams.FilterType = Enum.RaycastFilterType.Blacklist
overlapParams.FilterDescendantsInstances = {Character} -- so you cant hit yourself
for i = 0, 5 do -- how many times you would like to do checks in this case 5 checks 2.5 seconds long
local Hits = game.workspace:GetPartsInPart(HitBox, overlapParams)
for Index, Hit in pairs(Hits) do
local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
if Humanoid then
print("Character was Hit: ", Humanoid.Parent.Name)
end
end
task.wait(0.5) -- delay between checks
end