What do you want to achieve? Keep it simple and clear!
I want to have a gun that can maintain very high rates of fire of up to 1/600 a second seamlessly.
What is the issue? Include screenshots / videos if possible!
I have a gun that has a very high rate of fire and every time I try to fire my weapon at lets say 1/600 a second or even down to 1/50 a second there’s a lot of bullets that just pool up at the muzzle which causes some problems for me whether it be performance or they destroy each other for apparent reason despite being whitelisted to not destroy other bullets.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’m not sure how to solve this problem. I’m not sure if its an engine limitation or anything because im pretty sure even phantom forces are able to seamlessly instantiate bullets and have them fire at very high rates.
This is my code for instantiating the bullet
GunFired.OnServerEvent:Connect(function(player,ammo30,bullet30,Spawn30) if ammo30 > 0 then local bullet = bullet30:Clone() local bv = Instance.new("BodyVelocity") bullet.CFrame = Spawn30.CFrame bullet.Parent = workspace bv.Parent = bullet bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge) bv.Velocity = Spawn30.CFrame.LookVector * 700 ammo30 -= 1 GunFired:FireAllClients(ammo30) end end)
This is the bullet script that is responsible for self destruction and hit detection
local bullet = script.Parent local now = tick() --print("Bullet instantiated") game:GetService("Debris"):AddItem(bullet,5) bullet.Touched:Connect(function(hit) print("Hit something "..hit.Name) if hit.Parent:FindFirstChild("Humanoid") then print("Hit someone") local humanoid = hit.Parent.Humanoid humanoid.Health -= 10 bullet:Destroy() else print("Hit something else "..hit.Name) if (hit.Name == "Bullet30" or hit.Name == "Bullet120") then --print("Hit something that wasnt a bullet") --bullet:Destroy() return end bullet:Destroy() end end)