local CollectionService = game:GetService("CollectionService")
local function New(stair)
print(stair)
stair.PrimaryPart:GetPropertyChangedSignal("Position"):Connect(function()
print("MOVE")
end)
task.spawn(function()
while true do
print(stair.PrimaryPart.Position)
task.wait()
end
end)
end
CollectionService:GetInstanceAddedSignal("Stair"):Connect(function(stair)
New(stair)
end)
for _, stair in CollectionService:GetTagged("Stair") do
New(stair)
end
I’m play testing in studio (no client) and moving the stairs around, and it’s printing that the position is changing, but GetPropertyChangedSignal() never fires for it
I think the reason is that the Position property is not a direct property of an object, try :GetPropertyChangedSignal("CFrame") because the Position property is stored inside the CFrame property.
GetPropertyChangedSignal("Position") doesn’t work unfortunately, you’ll need to use a loop to get position updates like this example:
local oldPosition = Vector3.zero
task.spawn(function()
while true do
if stair.PrimaryPart.Position ~= oldPosition then
print("MOVE")
oldPosition = stair.PrimaryPart.Position
end
task.wait()
end
end)
Even GetPropertyChangedSignal("CFrame") doesn’t work for example
Edit: @NinjoOnline Also I forgot to mention, using this:
local oldPosition = stair.PrimaryPart.Position
at the top instead of this:
local oldPosition = Vector3.zero
might work closer to what you’d like since it doesn’t run until the stair changes its position from its default
Changing the Model/Parts Position with the mouse is not possible, it will not change it’s position then. Only things like TweenService or a code that modifies the position will only run the code
I’ve ran into a similar issue myself. It’s not documented, but has been mentioned by others that GetPropertyChangedSignal will not fire if the property was changed due to physics. So if you are moving the staircase by physics, no, it will not fire.