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

2 comments
The code is also probs running before the part gets inserted
@SuperLittleAdmin why do you have multiple scrips? anyways just copy and paste the code but change the variables