Hello.
Gonna keep this post short and sweet. I’ve got an enemy that can do a stomp attack. Upon spawning and getting into adequate range, they stomp. All seems good. However, when they’re able to stomp again, they just don’t do it, despite meeting the same requirements as they always would need to meet to stomp.
Here’s what’s going on in my code:
Stomp Logic
stomp = function()
abilityTable.stomp = false
canMove.Value = false
local sound = mainSoundsFolder.Stomp:Clone()
sound.Parent = root
mainAnims.stomp:Play()
task.delay(0.967, function()
sound:Play()
game:GetService('Debris'):AddItem(sound, sound.TimeLength)
shockwaveModule.createShockwave(model, root.CFrame * CFrame.new(0, -8.934, 5), damage, 750, Color3.fromRGB(43,125,255), 3)
explosionModule.createExplosion(model, root.CFrame * CFrame.new(0, -8.934, 5), damage, 30, Color3.fromRGB(43,125,255), 2)
end)
task.delay(1.5, function()
print('done with stomping')
canMove = true
abilityTable.paused = false
end)
task.delay(abilityCooldowns.stomp + math.random(5, 15), function()
print('ready to stomp again!')
abilityTable.stomp = true
end)
end,
Stomp Detection Logic:
if distance <= ranges.stomp then
local num = math.random(1, 150) if num ~= 1 then return end
print('proc')
if not abilityTable.paused and abilityTable.stomp and isAlive() then
print('can do!', abilityTable.paused, abilityTable.stomp, isAlive())
local thread = coroutine.create(attackFunctions.stomp)
if currentCoro then
coroutine.close(currentCoro)
end
currentCoro = thread
coroutine.resume(thread)
end
end
Here’s what’s being printed in-game:
If you need any more details, I’d be happy to provide you with what you need. I genuinely have no idea what’s making this not work a second time.