RbxUtil icon indicating copy to clipboard operation
RbxUtil copied to clipboard

Comm ClientRemoteProperty initial observe race

Open Azuuu opened this issue 6 months ago • 0 comments

Had a weird race execution of the observer. If the property is ready the Changed Event is called first before the initial deferred callback. When the server called Set() on the property, Client receives the changed event but then since calling the ClientRemoteProperty:Observe() defers the current value. It overrides the change resulting to going back to the old value.

function ClientRemoteProperty:Observe(observer: (any) -> ())
	if self._ready then
		--task.defer(observer, self._value)
		task.spawn(observer, self._value)
	end
	return self.Changed:Connect(observer)
end

[!NOTE] I am not sure changing this to spawn to call it immediately fixes the whole thing. But doing this on my project fixes my issue.

Azuuu avatar Jun 26 '25 05:06 Azuuu