Greetings Developers,
The script below is a small portion of a larger script that spawns gold basepart’s every few seconds into the workspace and what i’m trying to achieve is so that if the amount of gold indexed in the workspace is equal or higher than 20 then it will stop spawning gold
I have managed to find a way to index parts if they were found in the workspace if the amount of gold was increasing but i’m stumped on how to update the value of “GoldWorkspaceCount” if the amount of gold found decreased
I could not find any solutions on the devforum or on youtube on what i’m trying to achieve so im posting this here
local GoldWorkspaceCount = 0
while task.wait(1) do
for i, v in pairs(workspace:GetChildren()) do
if v:IsA("BasePart") and v.Name == "Gold_Ore" then
GoldWorkspaceCount += 1
end
end
end