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

How can i make .Changed event work with CFrame?

Asked by 3 years ago
Edited 3 years ago

What i want to do is to detect if an object's cframe changed and then set the cframe to its original cframe.

Example script:

local Character = workspace:FindFirstChild(tostring(game:GetService("Players").LocalPlayer.Name))
local Part = Character and Character:FindFirstChild("HumanoidRootPart") or false


Part.Changed:Connect(function(prop)
    if tostring(prop) == "CFrame" then
        Part[prop] = CFrame.new(100,100,100) --Example cframe
    end
end)

However, CFrame doesnt not work with .Changed event. What can i do?

0
i only used .Changed event once or twice so i really don't know what to do RemsFriend -24 — 3y

Answer this question