Could you provide more information of what you’re trying to do? I have a feeling you could do this more efficiently with lerping so you don’t have to make weird decimal random numbers.
I need to randomly place a line at the bottom so that it doesn’t go into the area of the square. This square is the painted decal. The line can go either to the left (in the photo) or to the right of the square
Instead, pick a random number between 0, 1 to determine which side, and then another random number for the position inside that side.
local side = math.random(0,1)
local pos = math.random(0,100)/100
local badzone = 7 -- studs wide
local goodzone = 19 -- studs wide
local position = (pos * goodzone) + (side * (badzone + goodzone)) -- end result
Also, try to never use very precise numbers like 87.984 and 65.017 inside of code, it can be confusing to look at. Try to get those values directly from the parts so it can work even if the parts move.
Taking a little bit of your idea, I made it like this. I also reduced the numbers to a hundredth
local side = math.random(1,2)
if side == 1 then
script.Parent.Position = Vector3.new(math.random(80.02,87.98), 4.91, 33.02)
elseif side == 2 then
script.Parent.Position = Vector3.new(math.random(65.01,72.99), 4.91, 33.02)
end