So im trying to make a script that spawns parts inside of part at random positions... So the part is huge. I want other small parts to spawn inside. Here is what i have so far.

while wait() do
    local pos1 = math.random(script.Parent.Position.X, script.Parent.Position.Z)
    local pos2 = math.random(script.Parent.Position.X, script.Parent.Position.Z)

    local part = Instance.new("Part", script.Parent)
    part.Name = "Yes"
    part.Size = Vector3.new(15,15,15)
    part.Position = Vector3.new(pos1,350,pos2)
    wait(1)
	script.Parent.Yes:Destroy()
end

There is an error in console and here is what it says

 Workspace.Area.Script:2: bad argument #2 to 'random' (interval is empty)

1 comment

0

bump please help!!