"Value cannot be converted to a number" warning in output

I have this code that resets information in a GUI. It’s telling me that v.Count.Value cannot be converted to a number. “Count” is a NumberValue instance, and this has never happened before. How do I fix it?

for i,v in pairs(Slots:GetChildren()) do
		v.Occupied.Value = false
		v.Count.Value = nil
		v.ItemImage.Counter.Text = ""
		v.ItemName.Value = ""
		v.ItemImage.Image = ""
		for i,v in pairs(v.Tags:GetChildren()) do v.Value = false end
	end
3 Likes

You can’t set a NumberValue to nil, only numbers are allowed.
Do this instead:

v.Count.Value = 0

Or if you need 0, you can use -1 as a nil denominator

3 Likes

Thank you for this! Must’ve been a recent thing, since this code’s worked for months now!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.