local lastFired = tick() game:GetService("RunService").RenderStepped:Connect(function() if firing then if tick() - lastFired > fireDelay then gunShoot:FireServer(m.Hit.p, muzzle.CFrame.p) lastFired = tick() end if tick() - lastFired > 0.3 then local GunShellClone = gunshell:Clone() GunShellClone.Parent = game:GetService("Workspace") GunShellClone.CFrame = muzzle.CFrame + Vector3.new(0, 0, 0) GunShellClone.Velocity = -(muzzle.CFrame.RightVector) * 10 GunShellClone.CFrame = GunShellClone.CFrame * CFrame.Angles(math.random(0.3, 1), math.random(0.3, 1), math.random(0.3, 1)) local GunShellClone_sound = gunshell_sound:Clone() GunShellClone_sound.Parent = muzzle GunShellClone_sound:Play() wait(5) GunShellClone:Destroy() end end end)
So I wrote some code to make a full auto rifle full auto as well as a script for shell ejection. When I checked, the shells do get cloned, but for some reason in this instance they don't appear at all cause of the full auto thing not working out for the shells. First try they appeared first before the bullets and bullets only appeared after (the code was a bit different), second time they appeared once and stop appearing (also different code), and now they don't appear at all! I just need to get the ejected shells to appear at a slower rate as well as some camera shake at a slower rate from the full auto fire rate which is 0.1. Please help me.
Okay, thanks to Spjureeedd, I got it. I finally understood that I had to make a seperate variable which would be like lastFired, but for the shells. Thank you dude, I can't upvote your post but I surely would If I could.