Hey everyone. I’m having an issue with a reference to a boolean. It seems to change to thinking its a variable inside the script instead of a reference, giving me the error “Attempt to index boolean with ‘Value’” on line 30. For some reason it errors in an if statement, and it runs one time before throwing the error for subsequent runs.
I searched up the error on here, but came up empty-handed for answers.
Here’s what I got.
if isOpen.Value == false then -- Error here.
animUnlocked:Play()
task.wait(2.4)
isOpen.Value = true
else
animUnlocked:AdjustSpeed(1)
task.wait(2.4)
isOpen.Value = false
end
Are you sure you’re not re-defining it somewhere after?
Like I said, if you print isOpen right before the line that errors, you will likely see that it is a boolean value.
I can’t really provide a solution or any help unless you’re able to send the full script. From the snippets you’ve sent, it looks fine, but I can’t be sure since there might be other code in between.
I printed isOpen after every point where I set the variable to see where it redefines, and it only does after the script finishes. Maybe if i set it to a local reference inside the function, then it will work?