So basically this error happens when i drop all of my ammo, i dont know what is causing this...
while wait() do wait(0.01) if script.Parent:WaitForChild("Ammo").Value <= 0 then script.Parent.Parent:Destroy() end end
Is a few questionable flaws in your script. First, the loop. It’s a while wait, but then you added another wait(0.01)? You could do while wait(0.01) if you needed. But in your case, this loop is completely unnecessary. Instead of having a loop, just check if you have no ammo every time the ammo value is changed. Lastly, your error. This occurs because the script has no time to wait for Ammo since you didn’t set it to a variable. Doing this should fix your errors. Here is a (hopefully) fixed version of your script. I’m currently on mobile so I couldn’t test it, though.
local ammo = script.Parent:WaitForChild("Ammo") ammo.Changed:Connect(function(value) if value <= 0 then script.Parent.Parent:Destroy() end end)