I need to see if an animation has the “HitStop” marker that indicates when to turn off the hitbox. If it doesn’t, I need to just turn off the hitbox when the animation stops. There isn’t a way that I’ve found to tell if the hitmarker exists or not because :GetMarkerReachedSignal(markerName) always returns a signal, never nil.
It should look something like this, (this doesn’t work due to the problem stated above):
local hitStopSignal = anim:GetMarkerReachedSignal("HitStop")
if hitStopSignal then
hitStopSignal:Wait()
else
anim.Stopped:Wait()
end
hitbox:Destroy()
local hitStopSignal = anim:GetMarkerReachedSignal("HitStop")
local hitStopEvent
local stoppedEvent
local function disc()
hitStopEvent:Disconnect()
stoppedEvent:Disconnect()
hitbox:Destroy()
end
hitStopEvent = hitStopSignal:Connect(disc)
stoppedEvent = anim.Stopped:Connect(disc)
Then if either event happens, both will be disconnected and the hitbox will be destroyed.