I’m trying to make parts randomly spawn within a Region, here’s what I’ve tried:
local x = humanoidRoot.Position - Vector3.new(20, 3, 20)
local y = humanoidRoot.Position + Vector3.new(20, 10, 20)
local region = Region3.new(x, y)
local part = Instance.new("Part")
part.Anchored = true
part.CanCollide = false
local x, z = region.Size.X, region.Size.Z
part.Position = Vector3.new(math.random(x, z), 1, math.random(x, z))
--[[ they only spawn in one place, since X and Z are both 40
what should i do to get a random position?
--]]
part.Parent = workspace
Bassically I dont know what should go in the parenthesis for math.random()