BoolValue.Changed failing to run?

At the moment, I have been trying to create a queue system; but encountered a confusing problem: BoolValue.Changed seems not to run the code under the function. To test it out, I changed the bools manually while in test mode while accessing the explorer tab. I also have checked 2 posts in the forum and hub but none have been useful to solve my problem. I would appreciate it if you would help me on what could be just a rookie mistake. Thank you!

A Piece of the Pie:

	print("Queue1 is ready!")
if script.Parent:FindFirstChild("queue1"):FindFirstChild("ready") == true and script.Parent.queue2.ready == true then



What’s going on here is that you’re comparing an instance to a boolean. Since the boolean is stored in the Value property of the BooleanValue you need to aquire that instead of the instance itself. The .Changed event of Value Instances also comes with one argument: the new value.

if script.Parent.queue2.ready == true then
    --Will always run as the ready instance exists 

if script.Parent.queue2.ready.Value == true then
    --Runs if ready is set to true

    if Val == true then
        --Runs if ready (Val) is set to true.
1 Like

Wow I’ve never noticed that. Thanks for replying; but that’s another problem I have to fix lol! The problem with the code is that print(“Queue1 is ready!”) won’t even run; so I assume the event doesn’t even fire at the first place. How would I make the event fire? (take note: i tried manually changing the bools while in test mode)

The only issue I could think of is that you’re storing your Kit inside of ServerStorage. Since ServerStorage is meant to store instances scripts will not run inside them.

If this isn’t the case there may be something very irregular going on. Try running the code in an empty place and see if the issue persists.

1 Like

The kit is in workplace so that can’t be the problem. I’ll try testing it in an empty place. Thanks again for your time!

Yeah. I tried creating and testing another change event in an empty place but the code still won’t run.

Out of curiosity: do you ever change to the server view while flipping the value? If you flip the value of the BoolValue while the camera is still on the character (indicative of the client view), that simulates a change created by the client and by nature of that, the server will not see that the value has changed.

You can flip the environment you’re testing from under the Test tab. You’ll notice the environment toggler right away: Client being a blue computer-like icon.


Okay, I think I know what’s going on now.

You’re most likely setting the boolean while in client mode. This means that the server (your script) will not pick up your input.

While in play solo, find the button labeled "Current: Client’ and click it to switch to server view. Try changing the value while in this mode, the server should notice.

Edit: See post above

That may just be the problem! I’ll test it real quick.

Mhm…Turns out i’ve been testing it out using client instead of server. Thanks to you both for helping me :slight_smile:

1 Like