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

how can i get position of part from script?

Asked by 3 years ago
Edited 3 years ago

I have created script that changes anchor of part to false, and makes this part fall on floor. but, after 3 secounds i want same part to return to its defaut position.

i want script to check position of part before it falls on the ground, to make it return on its defaut position, but i dont know how to check position of part by using script.

-- not working script

local PartPosition = script.Parent.Position

script.Parent.Touched:Connect(function() wait(1) script.Parent.Anchored = false wait(3) script.Parent.Position = PartPosition

end)

And yeah, sorry for bad english

0
i think it does but since the position youre giving to the part is the same because partposition is the position of the same part qu_uo 0 — 3y
0
btw. lines of code are placed correctly, website messed it up a little. Dawnymurzyn 7 — 3y

2 answers

Log in to vote
0
Answered by
qu_uo 0
3 years ago
Edited 3 years ago

i think it does but since the position youre giving to the part is the same because partposition is the position of the same part

do smth like local position = "original position of the part here"

script.Parent.Touched:Connect(function() wait(1) script.Parent.Anchored = false wait(3) script.Parent.Position = position

end)

0
Thanks for help, works. Dawnymurzyn 7 — 3y
Ad
Log in to vote
0
Answered by
NEILASc 84
3 years ago

You Can Create A New Part With The Same Position As The Part Your Making It Fall. So Make Starter Position Invisible, Uncollidable And Anchored. And The Just Do This Code:

local StartPos = [your starter pos start namethingy]

script.Parent.Touched:Connect(function()
wait(1) 
script.Parent.Anchored = false
wait(3)
script.Parent.Position = StartPos

end)

Answer this question