ObjectValue not firing .Changed event?
Title. ObjectValue is created on server and sent to client. The listener in the client is not firing as expected:
CLIENT
01 | assignPartyObject.OnClientEvent:Connect( function (partyObject) |
03 | print ( "Assigned a party object" ) |
07 | party.Changed:Connect( function () |
08 | print ( "Party changed to " .. party.Value.Name) |
09 | party.Value.ChildAdded:Connect(updateParty) |
10 | party.Value.ChildRemoved:Connect(updateParty) |
SERVER
1 | players.PlayerAdded:Connect( function (addedPlayer) |
2 | local addedPlayerPartyObject = Instance.new( "ObjectValue" ) |
3 | addedPlayerPartyObject.Parent = addedPlayer |
4 | addedPlayerPartyObject.Name = "Party" |
6 | assignPartyObject:FireClient(addedPlayer, addedPlayerPartyObject) |
The server then changes the value of the ObjectValue.
1 | reciever:WaitForChild( "Party" ).Value = party |
I am 100% certain that the property is being changed. I can see it in the properties tab under explorer and scripts can access the new and old values. The only thing that isn't working is that the listener is not firing.
The print statement fires and no warnings or errors are printed. Can someone explain what kind of black magic this is? I've tried all sorts of weird tests and haven't closed in on a solution. I'll respond quickly to any questions
I'm wondering if it has something to do with the .Changed listener being nested inside that remote listener, but I don't know why that would be. Making my own listener on a clock works perfectly, but this is disgusting practice and it makes my eyes bleed so I'd rather figure out what's wrong here.