Is the message consider changing it to local saying to convert c into an upvalue like you did, so that it can be used on line 12?
I believe @rogeriodec_games’s issue is that the warning Global ‘c’ is only used in the enclosing function defined at line 2; consider changing it to local
doesn’t really make sense here, since the global c is used outside it’s enclosing function b, rather than the anonymous callback function for PlayerAdded (well, it’s used in both, but the issue is that it’s defined inside the scope of b and is trying to be used outside of it).
Because in this case adding a local definition for c would need to happen at the top level, which is approximately equivalent to a local. Adding a local in this case doesn’t make code more robust - the reason why this warning exists is that if c references something like Player object you may see subtle issues in the code due to conflating state from multiple callback calls. When it’s at the top level, it doesn’t matter because the code is executed once, so we don’t warn.
It should stay up. It’s good that OP didn’t firstly assume that it was a bug, but rather user error, hence the first topic being in #help-and-feedback:scripting-support . It didn’t look like the replies were too helpful therefore had to assume it was a bug, luckily everything has been cleared up. Future readers may assume similar in the future therefore this topic should be available to them.