I'm trying to wait 1 second then destroy an object, but it delays the loop by one second. I've tried to use the variable outside of the loop, but that doesn't work either.
note: i'm cloning a bullet shell locally
You can do this multiple ways, here is a couple...
while true do local part = Instance.new("Part) part.Parent = workspace game.Debris:AddItem(part, 1) -- Gets destroyed after 1 second end
or
while true do local part = Instance.new("Part) part.Parent = workspace coroutine.wrap(function() wait(1) part:Destroy() end)() end
I prefer the first example, but sometimes the second one is necessary for specific reasons.