I’ve made a spin attack for my character, and when it collides with another Humanoid, it sends them away a few studs. The way this works is I’ve welded a cylinder part around my character to act as the ‘hitbox’ and it only becomes Touchable during the spin attack animation. I have a hitbox.Touched event that applies backwards velocity onto the Humanoid(s) that are hit by the attack.
--This is a server script that handles the physics. The .Touched event is in a local script.
kill.OnServerEvent:Connect(function(player,character,victim)
local hitbox = character:WaitForChild("spinHitbox")
local distanceX = victim.HumanoidRootPart.Position.X - hitbox.Position.X
local distanceZ = victim.HumanoidRootPart.Position.Z - hitbox.Position.Z
victim.HumanoidRootPart:ApplyImpulse(Vector3.new(distanceX*200,100,distanceZ*200))
end)
When testing this, I immediately noticed that even though the hitbox is only active during the spin attack animation, it still collides several times with other Humanoids, which multiplies their velocity exponentially. (See video below)
To combat this, I tried adding a debounce on the .Touched event, but this makes it so that only one Humanoid is affected at a time. (I want all enemies within range to be pushed back)
Btw, the models/animations are bad because it’s inspired by Supra Mayro 64.