Help On Cleaning Up My Script

Hey it’s me Army, and I recently created a script that makes a circle based off of the amount of objects you want in it.

This is the finished and working result:

local Original = workspace.Example
local CenterPoint =,.5,0)
local Amount = 100

local Count = 0

	local Part = Original:Clone()
	Part.Parent = workspace
	Part.Position = CenterPoint
	Part.Orientation =, 360/Amount*Count, 0)
	Part.Anchored = true
	Part.CFrame = Part.CFrame + Part.CFrame.LookVector * Amount

	Count = Count + 1
until Count == Amount

Now I think this is ok but I do also think it could be better, such as replacing the Vector3s with CFrames, or maybe some extra indention.

But, the thing is, I’m still new to roblox studio and Don’t understand how to use keyframes, and I’m not good with code formatting either.

Do you have some recommendations on how to clean up my script? I’ll be showing it to other people later so I don’t want it to look messy, thank you :smiley_cat:

local Original = workspace.Example
local CenterPoint =, 0.5, 0)

local Amount = 100

for Count = 0, Amount, 1 do task.wait()
    local Part = Original:Clone()

    Part.Position = CenterPoint
    Part.Orientation =, 360 / Amount * Count, 0)
    Part.CFrame += Part.CFrame.LookVector * Amount
    Part.Anchored = true
    Part.Parent = workspace

I recommend using a for loop for this
also set the parent after all the properties

I also used += to shorten code
a = a + b is the same as a += b

EDIT: fixed code a bit

Could you break this up and explain for me please?

for Count = Start, End, Increment do

basically this runs until Start is equal to End or if Start would be greater then End for the next iteration

every time the loop runs Start is added by Increment

for Count = 1, 5, 1 do

the output for this would be

more information in that link

Thank you, this answered a lot and helped me organize my stuff better.

(Now if u excuse me, I need to sleep)