Problem with weapon fire rate

The way I do my firerate check is the following

shootCheck = function(dt)
	local canShoot = md

	if canShoot and (tick() - lastShot) >= (60 / module.cgun.gmod.firerate) then
		shoot()
		lastShot = tick()
	end
end

The problem is that this is ran in a RenderStepped loop, which isn’t good because if any gun firerates are < 0.1 (60 / 600) then they fire at 0.1 RPS.

Is there any solution to this?
(I am aware ROBLOX has added an official FPS unlocker so this is obsolete, but oh well)

Video of this happening:


Keep an eye on the goal and actual firerates ^

You can use an accumulator so sometimes in one frame you fire 2 bullets to compensate for low framerates.

I’ll see what I can do. Thanks for the suggestion :slight_smile:

It works! Thank you for fixing this miniscule bug.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.