Would you elaborate a little more? If I understand your code correctly, you are checking if the text “Char Sing” is in NoteData[i][“k”]. Maybe the problem you are facing is that once CharIsAllowed is true it never changes to false? You can solve that (and simplify your code) like this:
if is_instance_valid(NoteData[i][“k”]):
var KInstance = NoteData[i][“k”]
CharIsAllowed = KInstance == “Char Sing”
BTW, to properly format your code you can follow these instructions: Make it easier for new users to format and preview code in their posts - #4 by gertkeno