What causes rates to keep increasing?

The rates of the scripts in my game keeps increasing to quite a large amount. What’s causing it and does it affect performance? The activity % are pretty much stable compared to the rates.

image
After 3 minutes:

Roblox’s default Sound Script’s rates are also increasing.

Is it related to the lua thread count? When I ran the same scripts on studio, my thread count continues to increase, even if I disable the script.

image

2 Likes

Rate is how much the script runs per second, and it does affect performance. A rate of 3600 and 12000 is pretty alarming and I would definitely consider checking the script that is causing this high rate. There is a lot that can easily cause a script’s rate to go out of control, for example a block that is constantly touching something else has the Touched event connected in a script.

3 Likes

Keep in mind that there is currently a bug with the Developer Console where the rate will constantly keep increasing after the first time you open it

3 Likes

I see, however, this is one of the script and it’s just a basic flicking light script, but it still goes up to 1886/s.

function toggleOff()
script.Parent.SpotLight.Enabled = false;
script.Parent.Material = Enum.Material.SmoothPlastic;
script.Parent.Attachment.PointLight.Enabled = false;
end
function toggleOn()
	script.Parent.SpotLight.Enabled = true;
	script.Parent.Material = Enum.Material.Neon;
	script.Parent.Attachment.PointLight.Enabled = true;
end


while true do
	wait(1);
	toggleOff()
	for a=1, 2 do
	    wait(0.1);
	    toggleOn();
	    wait(0.1);
	    toggleOff()
	end
	wait(2);
	toggleOn();
end
1 Like

Yeah, this is probably just the bug I mentioned above, where the rate will constantly keep adding to itself (it never decreases).

If this is the case, you shouldn’t worry as the actual rate is much much lower.

1 Like

Is this script only used in one light or multiple?

1 Like

Just 3 separate scripts.

Maybe what @TetraDev posted is what I’m also experiencing…

1 Like

Very odd, looks like it is probably the bug referenced earlier then. The only possibility I could think of is that there is a memory leak within the script which causes the script to never truly end.

1 Like

Thanks for the help, I just confirmed this on studio… I ran the scripts in a new place at extreme mode (spawning and killing 100 humanoids every 2 secs) and the rates were reasonable.

image

1 Like