.Changed Event not firing

i have a module script which changes the value, and a server script which calls the function that changes the value, then the changed event is used however it doesnt fire

server script

boolvalue.Changed:Connect(function()
		print('changed') --doesnt print
end)
otherboolvalue.Changed:Connect(function()
		print('changed') --also doesnt print
end)

module.functionWhichChangesValue()
1 Like

What is boolvalue (as in what is it actually? Is it an boolean object, or just a bool within the script?)

the boolvalue is a boolvalue in rep storage

Can you show how you actually define it in the script?

repstorage:FindFirstChild("boolvalue")

Hmm.

If you add a print statement BEFORE the changed statements, does it fire?

yeah, the changed events are yielding the script or anything, just isnt being fired
doesnt really make sense why it wouldnt be fired though, also in the module i added a changed event after i actually change the value just to see if that would work too but it doesnt

So the print statement prior to the changed statements definitely fired?

How exactly are you changing the values? Is it from the server or from the client?

module changes the value, but thats only when the function gets called through the server script

I guess another way you could try to fix it is to change how you detect it

boolvalue.Changed:Connect(function()

could be replaced with

boolvalue:GetPropertyChangedSignal("Value"):Connect(function()

ive already tried that before, is there any reasons why Changed wouldnt fire (like if its being changed from module)

Just know that sometimes it fixes this issue.

If you put the relevant code into a normal server script instead of a module script, does it work?

well possibly but the module has some functions; StartIntermission, StartGame and how the server script should work is intermission is called, then once the intermission is over in the module it changes a value, serverscript sees changed value then calls StartGame, then once the game is over it calls StartIntermission and keeps looping like that

well possibly

Can you please try it? (Just the .Changed events + the print statements). This will ensure that the actual issue is caused from the code you provided initially

1 Like

sure but i found an error in the module and when i fixed it the changed events started to work so im gonna try this first

heres what i found out so far (i still havent tried your method yet)
the changed events wont run at all if the module.Intermission() function is called before the changed events:
this wont work:

GameFunctions.Intermission()

IntermissionEnded.Changed:Connect(function()
		--print('Game Started')
GameFunctions.StartGame()
end)
GameEnded.Changed:Connect(function()
		--print("Game Ended, Intermission Started")
GameFunctions.Intermission()
	end
end)
--if GameFunctions.Intermission() was here, the Changed Events do work

however the problem with putting GameFunctions.Intermission() after the changed events is that for some reason that gets called when the game ends (the one in the IntermissionEnded event runs, and the one outside of it runs
this is what that looks like

IntermissionEnded.Changed:Connect(function()
GameFunctions.StartGame() --these both run at the same time, this is the problem
end)
GameEnded.Changed:Connect(function()
GameFunctions.Intermission()
	end
end)
GameFunctions.Intermission() --these both run at the same time, this is the problem