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

Z cannot be assigned to?

Asked by 3 years ago
Edited 3 years ago

so i want a part to stick to the other part but it says Z cannot be assigned to

while true do
    script.Parent.Position.Z = script.Parent.Parent.Part2.Position.Z - 1
    end

1 answer

Log in to vote
0
Answered by
Neatwyy 123
3 years ago
Edited 3 years ago

You can't change the z value of a position, you would have to do this instead.

while true do
    local pos = script.Parent.Parent.Part2.Position

    script.Parent.Position = Vector3.new(pos.X, pos.Y, pos.Z - 1)
    wait() -- Don't forget the wait()
end
0
thx totosimamora608 61 — 3y
0
Happy to help! Neatwyy 123 — 3y
Ad

Answer this question