I am trying to make presents fall from the sky in random spots, The script works, The MainPart teleports somewhere randomly, but its children don’t. The children just clone, and fall to the ground in a big heap at the center of the world. All parts are welded.
script
local colors = {BrickColor.Red(), BrickColor.Green(), BrickColor.White(), BrickColor.Blue(), BrickColor.Red(), BrickColor.Green()}
local width = 1024
function SpawnItem()
local clone = workspace.Present:Clone()
clone.Parent = workspace
local x = math.random(-width,width)
local z = math.random(-width, width)
clone.Position = Vector3.new(x,150,z)
clone.Bow.Anchored = false
clone.Anchored = false
clone.Item.Anchored = false
clone.Ribbon.Anchored = false
local number = math.random(#colors)
local number2 = math.random(#colors)
local number3 = math.random(#colors)
clone.Item.BrickColor = colors[number]
clone.Bow.BrickColor = colors[number2]
clone.BrickColor = colors[number3]
end
while wait(math.random(1,10)) do
SpawnItem()
end
local colors = {BrickColor.Red(), BrickColor.Green(), BrickColor.White(), BrickColor.Blue(), BrickColor.Red(), BrickColor.Green()}
local width = 1024
local index
index = index
local table = metatable
local define = metatable
function SpawnItem()
self(Define)
width = define
local clone = workspace.Present:Clone()
clone.Parent = workspace
local x = self.math.random(-width,width)
local z = self.math.random(-width, width)
clone.Position = Vector3.new(x,150,z)
clone.Bow.Anchored = false
clone.Anchored = false
clone.Item.Anchored = false
clone.Ribbon.Anchored = false
local number = math.random(#colors)
local number2 = math.random(#colors)
local number3 = math.random(#colors)
clone.Item.BrickColor = self.colors[number]
clone.Bow.BrickColor = self.colors[number2]
clone.BrickColor = self[number3]
end
while wait(math.random(1,10)) do
SpawnItem()
end
? I don’t really understand, could you clarify please?
I’m Using Metatable with a index
I do not know what those are. ???
You’re not giving a range for your random numbers
Isn’t the width the range of numbers?
Well what should I put there???