GetPropertyChangedSignal not firing, but the property does change as proved by loop

MouseConnection = Mouse:GetPropertyChangedSignal("Target"):Connect(function()
  print("HI")
end)
while wait(1) do print(Mouse.Target) end

HI is never printed, but each second something different is printed from line 4, any idea why?
Not sure if it’s relevant but I’ve messed with mouse settings to disable the cursor.

Full Script

--// BedroomA.lua // SetAsync. // Module to be called from client.
return function()
	local Player = game:GetService("Players").LocalPlayer
	local UserInputService = game:GetService("UserInputService")
	
	-- [1] - Wait for introduction screen.
	local Loading = Player.PlayerGui.Introduction
	if Loading.Enabled then
		Loading:GetPropertyChangedSignal("Enabled"):Wait()
	end

	-- [2] - Turn on the PC.
	local Hint = Player.PlayerGui.Hint.Main
	Hint.Text.Text = "Turn on your computer."
	Hint.Visible = true
	
	local Billboard = Player.PlayerGui.Prompt
	local Mouse = Player:GetMouse()
	local MouseConnection, UISConnection, PromptActive, Next
	MouseConnection = Mouse:GetPropertyChangedSignal("Target"):Connect(function()
		print("HI")
		--PromptActive = (Mouse.Target.Name == "PCPromptPart") 
		--print(PromptActive)
		--if PromptActive then
		--	Billboard.TextLabel.Text = "E - Turn on"
		--	Billboard.Enabled = true
		--	Billboard.Adornee = Mouse.Target
		--else
		--	Billboard.Adornee = nil
		--	Billboard.Enabled = false
		--end
	end)
	while wait(1) do print(Mouse.Target) end

	UISConnection = UserInputService.InputBegan:Connect(function(KeyCode, GameProcess)
		if PromptActive then
			if not GameProcess then
				if KeyCode == Enum.KeyCode.E then
					--MouseConnection:Disconnect()
					--UISConnection:Disconnect()
					--Next()
				end
			end
		end
	end)
	
	function Next()
		Hint.Visible = false
	end
end

I would recommend updating the billboard’s adornee every frame using RunService’s Heartbeat event rather than using property changed signal (RunService.Heartbeat). As for the event not firing, I also had some cases of GetPropertyChangedSignal not working in local scripts and instead having to use the Changed event. I’m not sure what causes this, might be studio bug.

1 Like

Certain properties cannot have their changes listened to via GetPropertyChangedSignal(), that includes the mouse object’s ‘Target’ property.

1 Like