So basically I made a circle of parts but aren’t that good with math and need some help on how I would make a circle of parts each angle out like away from the player as in this picture below.
Basically the parts are all angled out relative to his player and I was wondering how to do the math for this?
Here’s my circle and code for it already.
local Radius = 12
local NumberOfParts = 30
local Circle = math.pi * 2
local DebrisTable = {}
for i = 1,NumberOfParts do
local angle = Circle / NumberOfParts * i
local Xpos = math.cos(angle) * Radius
local Ypos = math.sin(angle) * Radius
local Pos = Player.Character.HumanoidRootPart.Position + Vector3.new(Xpos,0,Ypos)
local Results = Library.Functions.Raycast(Pos,Vector3.new(0,-5,0),{Player.Character,Parts})
if Results then
local Debris = Instance.new("Part",workspace)
table.insert(DebrisTable,Debris)
Debris.Size = Vector3.new(2,2,2)
Debris.Anchored = true
Debris.BrickColor = Results.Instance.BrickColor
Debris.Material = Results.Instance.Material
Debris.Position = Results.Position - Vector3.new(0,3,0)
Debris.Orientation = Vector3.new(math.random(-360,360),math.random(-360,360),math.random(-360,360))
local Tween = Library.Functions.Tween(Debris,{Position = Debris.Position + Vector3.new(0,3.5,0)},0.25)
Tween.Completed:Connect(function() Library.Functions.Tween(Debris,{Position = Debris.Position + Vector3.new(0,-0.5,0)},0.25) end)
end
end