GetPropertyChangedSignal not working

Seems when the forcefield.Transparency changes nothing happens. The forcefields obviously being found as the PlayerAdded part works and tells me whether the gate is up or down.

The arrow shows where the property changed but no print statement.
image

local forcefield2 = game.Workspace.GameAssets.Forcefields.Forcefield2
local forcefield4 = game.Workspace.GameAssets.Forcefields.Forcefield4

forcefield2:GetPropertyChangedSignal("Transparency"):Connect(function()
	if forcefield2.Transparency == 1 then
		print("Do something!")
	else
		print("Do nothing!")
	end
end)

game.Players.PlayerAdded:Connect(function(player)
	if forcefield2.Transparency == 1 then
		print("Gate is down!")
	else
		print("Gate is up")
	end
end)

I’m not entirely sure what’s missing.

The problem is that you’re not changing the transparency of the forcefield. So the GetPropertyChangedSignal is never firing.

1 Like

Isn’t transparency a number value?
So, something like this instead:

forcefield2.Transparency:GetPropertyChangedSignal("Value"):Connect(function()
    -- ..
end)

It’s being changed in another script. All I want is this script to listen and when it changes then fire.

Actually, I don’t think Transparency has a Value property. Transparency itself is the property that requires changing, not its value.

It’s not a value.
image

Nvm I worked it out. In my “enter word for how stupid I am” I forgot it’s supposed to be a local script since it’s clientside. Works fine now!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.