Hello, I managed to make parts spawn in a circle but how would I go about spawning parts inside the circle
This is my script
local function NewStick(i)
local Stick = ItchRemote.QuestObject.DailyQuestStick:Clone()
Stick.Name = "Stick"..i
for _,part in pairs(Stick:GetChildren()) do
if part:IsA('BasePart') then
part.Anchored = true
part.CanCollide = false
end
end
local PickUp = Instance.new('ProximityPrompt',Stick.PrimaryPart)
PickUp.ObjectText = "Herbs"
PickUp.ActionText = "Pick Up"
PickUp.HoldDuration = .75
PickUp.KeyboardKeyCode = Enum.KeyCode.E
PickUp.RequiresLineOfSight = false
Stick.Parent = workspace
--- HEREEEEEEEEEEEE
local radius = 150
local angle = (math.pi*2/math.random(1,20)) * i
local x = radius * math.cos(angle)
local y = radius * math.sin(angle)
local part = Stick
part:SetPrimaryPartCFrame(HMRP.CFrame * CFrame.new(x, 50, y))
part:SetPrimaryPartCFrame(CFrame.new(part.PrimaryPart.CFrame.p, HMRP.CFrame.p))
local RayParam = RaycastParams.new()
RayParam.FilterDescendantsInstances = {game.Workspace.Baseplate}
RayParam.FilterType = Enum.RaycastFilterType.Whitelist
local ray = workspace:Raycast(part.PrimaryPart.Position,Vector3.new(0,-60,0),RayParam)
if ray then
Stick:MoveTo(Vector3.new(Stick.PrimaryPart.Position.X,ray.Position.Y,Stick.PrimaryPart.Position.Z) )
Stick:SetPrimaryPartCFrame(CFrame.new(Stick.PrimaryPart.Position.X, Stick.PrimaryPart.Size.Y / 2, Stick.PrimaryPart.Position.Z))
end
GPS(Stick.PrimaryPart)
PickUp.Triggered:Connect(function()
Increment(1)
Stick:Destroy()
end)
end
for i = 1,amt do
NewStick(i)
end
end