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

how to save original position of an object?

Asked by 3 years ago

i am trying to make a knocking down and regenerating street lamp

here is the script

script.Parent.Position.X = script.Parent.originalPos.Value.X
wait(0.1)
script.Parent.Position.Y = script.Parent.originalPos.Value.Y
wait(0.1)
script.Parent.Position.Z = script.Parent.originalPos.Value.X

also if you want to

can you possibly make so i don't have to spam the xyz thing

also this script doesn't work down here it just puts the part to 0,0,0

script.Parent.Position = script.Parent.originalPos.Value
wait(0.1)
script.Parent.Position = script.Parent.originalPos.Value
wait(0.1)
script.Parent.Position = script.Parent.originalPos.Value

2 answers

Log in to vote
1
Answered by 3 years ago

Make an int value under the lamp and copy and paste its position in there.

0
pro BulletproofVast 1033 — 3y
0
why not make a variable in the beginning of the script with the Vector3? local Originalpos = object.Position and when you want to put it back object.Position = Originalpos AntoninFearless 622 — 3y
0
i figured it out i just needed to turn it around jeremqpmfpi 41 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

i figured it out i just needed to turn it around

it needed to be

script.Parent.originalPos.Value = script.Parent.Position

Answer this question