local part = script.Parent.Part local itemSpawn = workspace.ItemSpawned local item = script.Parent.CurrentItem.Value repeat wait(5) local clone = part:Clone() clone.Position = Vector3.new(0,0.525,0) clone.Transparency = 0 clone.CanCollide = true clone.Parent = itemSpawn item = item + 1 until item == 20
The above script spawns a part that can be picked up until it spawned 20
There's another script that when the part is touched, the part get destroyed, and the currentItem.Value goes down by 1, but that is not working
local item = workspace.ItemSpawn.CurrentItem.Value script.Parent.Touched:Connect(function) item = item - 1 script.Parent:Destroy() end)
P.S. The question was edited to fit the script I rewrote a bit
Let me make your code easier
local part = script.Parent.Parent:FindFirstChild("Item").Part local currnetItem = game.ReplicatedStorage:FindFirstChild("CurrentItem").Value for i = 20, 1, -1 do local clone = part:Clone() clone.Parent = workspace clone.Position = (put your position here)
It's much easier to just use a for loop
.