This is sort of hard to explain, so let me try my best.
What I’m attempting to achieve is a system that raycasts a circle with a vector as the starting position, here is a picture of what I want in an over head view
local Part = game:GetService("Workspace"):WaitForChild("CenterPart")
local h, k = Part.Position.X, Part.Position.Z
for i = 1, 360, 10 do
x = h + 10 * math.cos(i)
z = k + 10 * math.cos(i)
local part = Instance.new("Part")
part.Anchored = true
part.Size = Vector3.new(1, 1, 1)
part.Position = Vector3.new(x, Part.Position.Y, z)
part.Parent = workspace
part.BrickColor = BrickColor.new("Really red")
end
You have to use radians when using math.cos or math.sin, so just put i in math.rad()
You have to use math.sin for x and math.cos for z, or vice versa, doesn’t really matter. You used the same function for both x and z, so you essentially made x and z equal.
Quick note about your loop: it will go 1, 11, 21, …, 351. I imagine you probably didn’t intend it to work like that (although it will do the job just fine).
This does beg the question… why are you doing this? Raycasting in the circle is generally a bad idea because there are better ways to do it. Is this for an explosion?