Here is the code:
local function runDropper(dropper)
spawn(function()
local loopWaitTime = dropper:WaitForChild("LoopWaitTime")
local oreValue = dropper:WaitForChild("OreValue")
local dropperPart = dropper:WaitForChild("DropperPart")
if loopWaitTime and oreValue and dropperPart then
local waitTime = loopWaitTime.Value
local oreToClone = Instance.new("Part")
local loopedTimes = 0
while true do
wait(2)
local newOre = oreToClone:Clone()
newOre.Name = "Ore"
newOre.Parent = dropper
newOre.Size = Vector3.new(1, 1, 1)
newOre.Position = dropperPart.Position
game.Debris:AddItem(newOre, 20)
local cash = Instance.new("NumberValue")
cash.Name = "Cash"
cash.Parent = newOre
cash.Value = oreValue.Value
loopedTimes = loopedTimes + 1
print(loopedTimes)
end
end
end)
end
return runDropper
when I print loopedTimes it only prints: 1 Could someone tell me what is wrong? I have no idea. Thanks!

5 comments
Try adding the wait() between the while and do
What? That won't solve anything.
theCJarmy7 "while wait() do" is a shorthand of "while true do wait()" considering wait() only yeilds the code and not really anything else
if ANY error happens in the loop the script stops and the loop does not go anymore
I figured out the problem. That is why it says [Solved]