Because as far as I know there isnt a changed event for it. Ive tried some while loop updaters but they were too laggy, and im stumped on what other options i might have. Could someone tell me how to do this?
✓ ANSWER ACCEPTED
How do you detect if a part's position has been changed?
1 answer
✓ Accepted answer
Use Changed. This even fires whenever property of an instance is changed, like position!
script.Parent.Changed:connect(function(pos)--You need a function
if pos == "Position" then --if pos is position then
print("PartMoved")
end
end)
If you want to record the old position and the new one try this script:
local oldpos = script.Parent.Position
local newpos
script.Parent.Changed:connect(function(pos)
if pos == "Position" then --if pos is position then
if newpos ~= nil then
oldpos = newpos
end
newpos = script.Parent.Position
end
end)
Hope it helps!
This discussion is preserved as it was. New answers, comments, and votes are closed.
