Positioning parts like a star around the player?

here is a demo project that might help
Positioning parts like a star.rbxl (34.7 KB)

and this is what it looks like

and this is the script inside the demo project

local runService = game:GetService("RunService")

local character = script.Parent
local rootPart = character.HumanoidRootPart
local distance = 10
local amount = 5
local parts = {}

for i = 1, amount do
	parts[i] = Instance.new("Part")
	parts[i].Anchored = true
	parts[i].Size = Vector3.new(2, 2, 2)
	parts[i].Parent = workspace
end

runService.Heartbeat:Connect(function(deltaTime)
	for i = 1, amount do
		local angle = i / amount * math.pi * 2
		local offset = Vector3.new(math.sin(angle), 0, math.cos(angle)) * distance
		parts[i].Position = rootPart.Position + offset
	end
end)

and this video might help you understand the angle = i / amount * math.pi * 2 part

i will hopefully have a video in the future talking about sin and cos

7 Likes