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

How to make a circle generate faster?

Ok, so I know the title sounds confusing so I'm going to elaborate. I have a circle generation function that generates a circle using guis. It works perfectly fine, it just doesn't generate it fast enough.

I've set the wait time as low as I can possibly get it using runService but it's still not fast enough.

local generateCircle = function(gui, health)
	local circumfrenceFormula = 360 * health / 100 
	
	for i = -180, circumfrenceFormula - 180 do 
		local x = x + r * math.sin(math.rad(i))
		local y = y + r * math.cos(math.rad(i))	
		
		local n = gui.Frame:clone()
		
		n.Position = UDim2.new(x, 0, y, 0)
		n.Rotation = i
		n.Parent = gui
		n.Visible = true
		
		runService.Stepped:wait()
	end
end

I'm using it for a custom health UI so it needs to go as fast as I can get it without it being instantaneous; Like a tween. Can I get any help with this?

1 answer

✓ Accepted answer

Instead of waiting for a shorter amount of time, move a further distance to adjust how fast it occurs. You can adjust your for loop so that it increases by multiple degrees each time rather than just one.

On line 4:

for i = -180, circumfrenceFormula - 180, DESIRED_DEGREES do

1 comment

0

AH! Thank you!

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