I’m currently attempting to make a sphere rapidly change its size randomly, but have run into an issue at the final required line of code, during a math… thing. (i do not know terminology)
whenever the code runs all steps are confirmed to be completed by a set of prints, but the error
“X cannot be assigned to -” appears. And i’m unsure of how to approach this.
the code
spawn(function()
while true do
wait(0.05)
print("did a do")
local xpmval = math.random(1,2)
local xval = math.random(0.05,0.15)
if xpmval == 1 then
print("val1")
if ball.Size.X <= 3 then
print("size up")
ball.Size.X = Vector3.new(ball.Size.X + xval)
elseif xpmval == 2 then
print("val2")
if ball.Size >0.5 then
print("size down")
end
end
end
end
end)
I haven’t been able to find any relevant topics on the devforum after a quick search, but if you know one that may have the answer (or you just know the answer) any help is appreciated.
still not changing the size, see anything going wrong here?
local ball = script.Parent
spawn(function()
while true do
wait(0.05)
print("did a do")
local xpmval = math.random(1,2)
local xval = math.random(0.05,0.15)
local yval = math.random(0.05,0.15)
local zval = math.random(0.05,0.15)
if xpmval == 1 then
print("val1")
if ball.Size.X <= 3 then
print("size up")
ball.Size += Vector3.new(xval,yval,zval)
elseif xpmval == 2 then
print("val2")
if ball.Size >0.5 then
print("size down")
end
end
end
end
end)
It’s not like that with normal parts, but on spheres, it requires all 3 sizes to be added upon and cylinders require x and z to be added upon to change the width (y on a cylinder can make it change height without any extra requirements).
If I had to say, it would be one of three reasons. One, the size increment is too small. Two, to properly change the size, the values need to be the same. Three, the size difference is too small to notice any change.