In this script, I am trying to make a part that changes sizes in random between 3 to 5. Depending on what the size is, it will subtract or add a random number to the size. The problem is that it keeps shrinking no matter what I do, and I cant make it stop. I’ve switched up the signs, values and everything that I could think of to make this work. Maybe its just some silly mistake but I cant piece together what im doing wrong in this script.
local Detector = script.Parent.ClickDetector
local prism = script.Parent
local Continuation = true
local function Update()
if prism.Size.X >= 5 then -- if bigger than 2 it makes it smaller
prism.Size -= Vector3.new(math.random(0.1,0.7),math.random(0.1,1),math.random(0.1,0.7))
elseif prism.Size.X <= 3 then -- if its smaller than 5 it gets smaller
prism.Size += Vector3.new(math.random(0.1,0.7),math.random(0.1,0.7),math.random(0.1,0.7))
end
end
Detector.MouseClick:Connect(function(click)
Update()
end)
thank you for your help/ reading this