Making a circle of parts around a point (Please Help)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Make a Circle Around a Point With Small Individual parts
  2. What is the issue? Include screenshots / videos if possible!
    i dont know how to make it work
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Ive tried just adding to it but it doesent circle around
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local Amt = 0
repeat
local Clone = game.Workspace.StormStats.BoarderParts.ClonePart:Clone()
Clone.Parent = game.Workspace.StormStats.BoarderParts.ClonePart.Parent
Clone.Name = "BoarderPart"
Clone.Position = Vector3.new(Orgin[1], game.Workspace.StormStats.BoarderParts.ClonePart.Position.Y, Orgin[2]) + Vector3.new(Radius * Amt,0,Radius * Amt)
Clone.CFrame = CFrame.lookAt(Clone.Position, Vector3.new(Orgin[1], Clone.Position.Y, Orgin[2]))
	wait(1)
	Amt += 5
	until false

Just a note this is not the full script but its all you realy need

What the Listed script does is it spawns a part and just places it behind the other one

I need the possition to be right next to the other in a circle around the radius i feel all i would need to do is find a equation but i dont know what that equation would be

Thanks For Any Help!!

Maybe this will help.

Place Items In a Circle (like Tokens In Bee Swarm)

i have to go but ill check this out thanks!

Alr i checked it out and im 99% sure it will work so thank you :slight_smile:

Skip the lesson, I want code now!

This is not real code. It is pseudocode. It does not work.
You still have to write it yourself.

function getCoordinates(radius: number, degrees: angle)
  xOffset = cos(angle) * radius
  yOffset = sin(angle) * radius

  return (xOffset, yOffset)
end

points = 10
radius = 10
stepAngle = 360 / points

currentAngle = 0
while currentAngle < 360 do
  place part at getCoordinates(10, currentAngle) relative to initial point
  currentAngle = currentAngle + stepAngle
end

If you have completed an education up to that of a 16 year old, you’ll probably recognise this:

This is a right-angled triangle inside a circle, where the hypotenuse of the triangle is equal to the radius of the circle.

What does that mean?
  • The hypotenuse is the longest side of the triangle.
  • The radius is half of the width of the circle. Think of it like drawing a line from the center of the circle to the outside of it, and then measuring its length.

The trigonometric ratios are the following:

  • sin(θ) = opposite / hypotenuse
  • cos(θ) = adjacent / hypotenuse
  • tan(θ) = opposite / adjacent

where the hypotenuse is the longest side, the opposite is the side opposite to the angle (θ) and the adjacent is, well, adjacent to the angle.

We can use these to find out the coordinates of a point on the circle! Rearranging these equations to find the opposite and the adjacent gives us this:

  • sin(θ) * hypotenuse = opposite
  • cos(θ) * hypotenuse = adjacent

These are our X and Y coordinates! So, remembering that the hypotenuse is equal to the radius of the circle, our pseudocode would look something like:

This is not real code. It does not work.

function getCoordinates(radius: number, degrees: angle)
  xOffset = cos(angle) * radius
  yOffset = sin(angle) * radius

  return (xOffset, yOffset)
end

Why is this useful? Well, our problem boils down to finding points on a circle around a point, and placing parts at those points. So, to solve this problem, we can do something like:

This is not real code. It does not work.

points = 10
radius = 10
stepAngle = 360 / points

currentAngle = 0
while currentAngle < 360 do
  place part at getCoordinates(10, currentAngle) relative to initial point
  currentAngle = currentAngle + stepAngle
end

This is a great example of how math(s) can be applied to the real world. But I’m not your teacher, you do you.

Thank you! This was definitely helpful and it will help me in modifying this as i have more i plan to do!

1 Like

Ive tried out your code and this is the result i get


I think its because your getting the x and y and not the x and z is that an error on your part or am i just stupid?

here is my code

points = 10
radius = 10
stepAngle = 360 / points
currentAngle = 0
while currentAngle < 360 do
	local Clone = script.Parent.ClonePart:Clone()
	Clone.Parent = script.Parent.ClonePart.Parent
	Clone.Position = Vector3.new(points, currentAngle)
	currentAngle = currentAngle + stepAngle
end

i used the “Place Items In A Circle” documentation and that worked but TYSM!

Looks like your setting the position to x = points, y = currentAngle (something between 0 - 360) and z is not being assigned (ends up being, Vector3.new(10, currentAngle, 0) so your placing them at the same x with an increasing y and z stays at 0 from not having been specified.

Glad to hear you got it working.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.