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

How could i check if a part moves, and if it does, move a cloned part to its original position?

Asked by
IrishFix 124
5 years ago

I really want to be able to add a system that actively checks if a part moved from its original position (i have it cloned in server storage) and then clone and parent the original clone to the workspace, then effectively "respawn" that part. But i dont know how?

Thanks in advance - Irish

1 answer

Log in to vote
1
Answered by 5 years ago

First, you can start off by using a method called GetPropertyChangedSignal() Then you can store the positions part in a variable -- Which we can get later

Once the position of that part is changed it will call the function and then all we do is set your clone parts position to the parts original position then all you have to do is update the position of the old parts.

local part = game.Workspace.Part -- This is the part you are going to track
local clonedPart -- Set this equal to the cloned part your trying to reference
local previousPosition = part.Position

part:GetPropertyChangedSignal("Position"):Connect(function()
    clonedPart.Position = previousPosition
    previousPosition = part.Position
end)

Instance:GetPropertyChangedSignal()

If this helps an upvote or solve would be appreciated. Good luck!

  • Best Regards, - Syn
0
CFrame and properties related to it such as Position don't fire the Changed signal or signals related to the Changed signal hiimgoodpack 2009 — 5y
0
Oh really? I was going off a hunch without manually calling a function or firing remotes when you move them? is there any other way? johndeer2233 439 — 5y
Ad

Answer this question