BoolValue.Changed is not running when it's set to true

I’ve been spending so much time trying to make this work with many other ways and so far it still won’t run. The local script is stored in StarterCharacterScripts and the values are also stored in the local script. I have a feeling that it might be why but i’m not sure.

--player
local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()

--functions

local functions = script:WaitForChild("Animatronics").Functions
--local dictionary_module = require(script.dictionary)

--getmodels

local AIs = workspace:FindFirstChild("AIs")
local Bonnie = AIs:WaitForChild("Bonnie")

--actions

local canJumpscare = functions.Bonnie:WaitForChild("CanJumpscare")
local JumpscarePos = AIs.Positions.MainJumpscare:FindFirstChild("JumpscarePos")

wait(10)

canJumpscare.Value = true

print("True")


canJumpscare.Changed:Connect(function()
	if canJumpscare == true then
		print("Jumpscare")
		--Bonnie.HumanoidRootPart.CFrame = JumpscarePos.CFrame
	end
end)

You’re listening for changes after setting the value to true. So it won’t capture that change. You should hook up the Changed listener before making changes to the value.

1 Like

I’ve put the Changed listener before it and it still won’t work.

canJumpscare.Changed:Connect(function()
	if canJumpscare == true then
		print("Jumpscare")
		--Bonnie.HumanoidRootPart.CFrame = JumpscarePos.CFrame
	end
end)

canJumpscare.Value = true

print("True")

You meant if canJumpscare.Value == true then?

1 Like

I am facing this issue as well
So I had to make a creative solution for it
I use IntValues instead of using BoolValues
like this

If game.WorkSpace.Test.Value == 10 then
 print("Test")
end

you can use it as the BoolValue as
hope that helped :sweat_smile:

1 Like

Oh my god. I didn’t even notice that. This always happens to me all the time haha. Thank you so much for pointing it out.

1 Like

Thank you for your help! But for what i’m making I need and like to use functions for something like this.