CurTime() seemingly speeds up when drawing rainbow text?

-snip-

Cause you multiply CurTime() … curtime gets bigger the longer the server stays open.
You need to add CurTime instead.

When I change it to this, the colors don’t move at all.

Its cause how its coded. You need to redo the math behind it. Its 4 in the morning here, so I can’t help you with that.

This seems like a good time to advertise my rainbow script.

In your case, this should work:



local function DrawRainbowText( multiplier, str, font, x, y, shift )
	
	surface.SetFont( font )
	
	for i = 1, #str do
		surface.SetTextColor( HSVToColor( ( i + shift ) * multiplier % 360, 1, 1 ) )
		local w = surface.GetTextSize( string.sub( str, 1, i - 1 ) )
		surface.SetTextPos( x + w, y )
		surface.DrawText( string.sub( str, i, i ) )
	end
	
end

hook.Add( "HUDPaint", "Jeff", function()
	DrawRainbowText( 30, "My name is Jeff", "DermaLarge", 50, 50, CurTime() * 10)
end )


Nevermind, got it working. Thanks.

Dont snip the OP. Other people can learn from your mistakes.