What does this mean?

Hello,

What does this error mean and how do I fix it?

Error:
X cannot be assigned to - Server - Script:8

(idk what it can’t be assigned to its just blank)

Script:

local boxNum = game.Workspace.boxNum
local box = game.Workspace.Box

while true do
	if boxNum.Value < 20 then
		print("Repopulating...")
		local newBox = box:Clone()
		newBox.Union.Position.X = math.random(-250, 250)
		newBox.Union.Position.Z = math.random(-250, 250)
		boxNum += 1
	end
	wait(0.5)
end'

The Vector3 type is immutable, which means it cannot be modified or altered.

So you’ll have to construct a new Vector3 with the new coordinates.

newBox.Union.Position = Vector3.new(
    math.random(-250, 250),
    newBox.Union.Position.Y,
    math.random(-250, 250)
)
1 Like

Does this change the Y posistion?

That will keep it the same. The X and Z coordinates are the ones that get changed

1 Like