Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
1

How do I make a part that has a changed position go back to it's original position?

Asked by 1 year ago

Code I have so far:

script.Parent.ClickDetector.MouseClick:Connect(function()
    script.Parent.CFrame = script.Parent.Parent["FrontHood_I"].CFrame
    script.Parent.Orientation = ("0, 0, -30")
end)

Now that it's position is exactly FrontHood_I's, how do I make it go back to it's original position?

1 answer

Log in to vote
1
Answered by 1 year ago

You should store the position in a variable before you change it and then have it go to the position stored in the variable when you need to.

Sample code:

local myPart = Instance.new("Part") -- Create a part
local myPartPos = myPart.Position -- Reference this to get the original position
-- Code below
0
Oh... shoot.. But thanks! sean_thecoolman 190 — 1y
0
If I helped, mark this answer as accepted please! BennyBoiOriginal 293 — 1y
Ad

Answer this question