Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I increase/decrease RCL gun firerate?

With RCL Gun scripts, what do I add to the line of code below to increase or decrease the firerate?

local tool = script.Parent local player = game:GetService("Players").LocalPlayer

tool.Equipped:connect(function(mouse) print("Tool equipped!")

mouse.Button1Down:connect(function()
	print("Mouse pressed!")
	local ray = Ray.new(tool.Handle.CFrame.p, (mouse.Hit.p - tool.Handle.CFrame.p).unit * 300)
	local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)

	local beam = Instance.new("Part", workspace)
	beam.BrickColor = BrickColor.new("Bright red")
	beam.FormFactor = "Custom"
	beam.Material = "Neon"
	beam.Transparency = 0.25
	beam.Anchored = true
	beam.Locked = true
	beam.CanCollide = false

	local distance = (tool.Handle.CFrame.p - position).magnitude
	beam.Size = Vector3.new(0.3, 0.3, distance)
	beam.CFrame = CFrame.new(tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)

	game:GetService("Debris"):AddItem(beam, 0.1)

	if part then
		local humanoid = part.Parent:FindFirstChild("Humanoid")

		if not humanoid then
			humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
		end

		if humanoid then
			humanoid:TakeDamage(15)
		end
	end
end)

end)

2 answers

game:GetService("Debris"):AddItem(beam, 0.1)

try lowering 0.1 to something else, if not then I think that's as fast as possible.

1 comment

0

Roblox operates every 0.029 seconds or so, so 0.1 isn't the smallest you can go. However, when the game deletes the debris will not impact the fire-rate (though it will impact how long the beams remain in the workspace).

This script doesn't control that - the rate of fire is simply "how quickly can you click". You might add a debounce to it to prevent more than 1 click for a unit of time.

(Of course, ideally you would use a loop that starts when the player holds down the mouse button and stops when they release the mouse button so they don't have to click repeatedly.)

This discussion is preserved as it was. New answers, comments, and votes are closed.