Setup:
Trash Piles FOLDER - inside ServerStorage
Dirt 1-4 - inside Trash Piles FOLDER
Script: (Placed inside ServerScriptStorage)
local Dirt1 = game.ServerStorage["Trash Piles"].Dirt1
local Dirt2 = game.ServerStorage["Trash Piles"].Dirt2
local Dirt3 = game.ServerStorage["Trash Piles"].Dirt3
local Dirt4 = game.ServerStorage["Trash Piles"].Dirt4
while true do
local randomDirt = math.random(1, 4)
local Clone = nil
if randomDirt == 1 then
Clone = Dirt1:Clone()
elseif randomDirt == 2 then
Clone = Dirt2:Clone()
elseif randomDirt == 3 then
Clone = Dirt3:Clone()
else
Clone = Dirt4:Clone()
end
if Clone:FindFirstChild("Parent") == nil then
while true do
local waitTime = math.random(30,50)
wait(waitTime)
Clone.Parent = game.Workspace
if Clone.Parent == game.Workspace then
Clone:Destroy()
break
end
end
end
end
Problem, there is output if I print hello world, the problem is that no piles spawn whatsoever, it’s left empty and it just runs the script without any piles spawning inside Workspace. The goal is to make the piles spawn in Workspace preferably still being inside the “Trash Piles” folder, why does this happen?