Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my meteor spawn script not working and not giving me an error?

Asked by 2 years ago

I am making a meteor game and I have a script that is supposed to randomly spawn in my meteor models but it only spawn in two meteors and gives me an error here is the error:

"invalid argument #2 to 'random' (interval is empty)" And I don't know how to fix it here is my script:

while wait(1) do
local pos1 = math.random(-1486,1486)
local pos2 = math.random(-1486,1486)

local folder = game.ReplicatedStorage.Meteors:GetChildren()
local meteors = folder[math.random(1, #folder)]
meteors.Parent = game.Workspace.InGameMeteors
meteors.Position = Vector3.new(pos1, 100, pos2)
end
0
That means there's nothing inside of the folder MattVSNNL 620 — 2y
0
Thanks Puffyjasonrocks84 39 — 2y

Answer this question