Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to run code when a model or part has moved?

Asked by
DBoi941 57
4 years ago

I have tried onChanged and that didn't work here is what I tried:

local object = script.Parent
local function onChanged(property)
    local value = object[property]

    print(object:GetFullName() .. "." .. property .. " (" .. typeof(value) .. ") changed to " .. tostring(value))
end
object.Changed:Connect(onChanged)

And I have also tried this:

script.Parent.Part.Changed:Connect(function(NewValue)
    print(NewValue)
    print("Worked")
end)
1
Google GetPropertyChanged Event. I personally rarely use it BlackOrange3343 2676 — 4y

Answer this question