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

How to make a variable be equal to the current position of a part?

Asked by 8 years ago

I want the variable x to be equal to the current x position of part

part=script.Parent
x=part.Position

That gives me x,y and z but i just need the x How would i make it so x= the current x position of the part.

1 answer

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
8 years ago

Position has its own X, Y, and Z sub-properties. Therefore you can just write,

local x = script.Parent.Position.X
0
well now i feel dum, ty Nick1482 50 — 8y
2
Also remember you aren't referencing the property, you're storing it. So whenever you make changes, it will only impact the variable itself, not the property of the object itself. PowerHotmail123 90 — 8y
Ad

Answer this question