I am making a game like Miners Haven, and I am having quite some trouble making a clear ore system. Basically, I have all of my ores in a certain folder, which I get using folder:GetChildren(), and put that in a for i,v in pairs loop and do v:Destroy() to get rid of them all. However, no matter how many ores there are in the folder, it will only destroy one ore.
I don’t know if I’m missing something or just being stupid, so if you want the code, here it is, but beware, it’s a bit janky:
local deb = 0
script.Parent:WaitForChild("Model"):WaitForChild("Middle"):WaitForChild("ProximityPrompt").Triggered:Connect(function(player)
local children = script.Parent.Parent.Parent:WaitForChild("MiscInfo"):WaitForChild("OresDropped"):GetChildren()
if player.Name == script.Parent.Parent.Parent.Owner.Value then
if deb == 0 then
deb = 1
print(#children) -- This returns how many ore is in the folder, I've had values of 5 in the output but yet again it only destroys one of the ore at a time.
print("Passed Children")
for i,v in pairs(children) do
print(i,v)
v:Destroy()
deb = 0
end
end
end
end)

4 comments
sounds like you are the useless one who can't get anything to work by yourself
skill issue
lmao you only waited for 1 day