So i’m trying to make a stamina system using number values. The number values are working great! They deplete as they should. But this one stinking line of code meets me with an error message!
Can you show what other instances are under the character? The issue might be caused by having multiple instances named Stamina under the character and that it is indexing the script instead of the value.
The issue is that you have multiple instances under your character named Stamina and Roblox cannot accurately predict which value you are trying to access. You can fix this by renaming one of the instances or by using FindFirstChildOfClass("NumberValue") to get the stamina value (but this wouldn’t work if you have multiple number values).
This issue occurred because you had 2 instances which shared the same name in this case that name was “Stamina” when creating models it is very important to ensure that child instances which will be referenced in scripts are given unique names that way they can uniquely be referenced by the script without any collision issues.
I think you should give @bmcqqq the solution mark. His post has very good explanation and details. It would help you and others understand what is the issue when encountering this problem.