function shooting(player,mousePosition)
local character = player.Character
local filter = {character, game.Workspace.AllBullets}
if cooldown then
cooldown = false
local hitPart = createRay(tool,character,mousePosition,filter)
gun.Shoot:Play()
flash.Transparency = createFlash(0)
delay(flashtime,function()
flash.Transparency = createFlash(1)
end)
delay(firerate,function()
cooldown = true
end)
return hitPart
end
end
I don't quite understand how to properly use coroutines multiple times because after one use they're dead. I ended up using delay and my code works, but I heard delayed isn't that reliable and shouldn't be used? The purpose of using delay here is so that return hitPart can be sent back right away and not after a long wait().
