So, I’m a bit new to Lua. I’ve only been scripting with it for like a month and a half. I came across a problem when trying to assign the position of an object.
script.Parent.Position.X = 136
script.Parent.Position.Y = -20
script.Parent.Position.Z = 112
The error message for it said “X cannot be assigned to” Anyone here got any solutions?
6 Likes
un1ND3X
(un1ND3X)
June 14, 2020, 8:58pm
#2
Assign the Position a Vector3 value once, not an integer thrice.
script.Parent.Position = Vector3.new(136, -20, 112) -- vector
16 Likes
incapaz
(uep)
June 14, 2020, 8:58pm
#3
Unfortunately Vector3 is immutable meaning you can’t change it. What you will have to do is
script.Parent.Position = Vector3.new(136, -20, 112)
to create a new instance of Vector3 and use that as the position
7 Likes
Alright, thanks for the help.
(30 characters.)
3 Likes