GetPropertyChangedSignal not working

The GetPropertyChangedSignal function does not detect the WorldPivot change when the model falls on another and bounces off it. Does anyone have an idea how to fix this?

local script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Configuration = require(ReplicatedStorage.Configuration)

workspace.Models.ChildAdded:Connect(function(model)
	if not model:IsA("Model") then return end
	
	model:GetPropertyChangedSignal("WorldPivot"):Connect(function()
		local pos = model.WorldPivot
		local rot = model.WorldPivot.Rotation
		if pos.Z == Configuration.z_pos then return end
		
		model:PivotTo(CFrame.new(Vector3.new(pos.X, pos.Y, Configuration.z_pos)))
	end)
end)
1 Like

Pretty sure any connection towards a CFrame or Pivot will only fire when your code sets the Pivot/CFrame value, if it didn’t behave this way it would probably spam your function and cause major lag.

1 Like

So you might want to hook up a RunService.Stepped function or however you want and just check if the previous Pivot is any different from the current pivot and make the change.

1 Like

Changed events don’t fire for Physics related properties such as CFrame, Position, WorldPivot, etc

You would need to do what @Kitsomia suggested or create a loop

while model.Parent do
  ---...
end

Well, cframe changes not worldpivot it’s only set through scripting. I recommend setting a primary part or checking a part in the model.

I dont want make loops like this because it very lags when i have a few models