script:
script.Parent.PrimaryPart = script.Parent.BasePart
local r = math.random(1,2)
if r == 1 then
local room = game.ReplicatedStorage.spawnconn2:Clone()
room.Parent = game.Workspace
room:MoveTo(script.Parent.BasePart.Position)
elseif r == 2 then
local room = game.ReplicatedStorage.spawnconn1:Clone()
room.Parent = game.Workspace
room:MoveTo(script.Parent.BasePart.Position)
end
problem: this script always picks 2 as the number. Every. Single. Time. I've tested it with adding more numbers, like 3, and it seems to always pick the highest number. Example, if it was (1,10), it would always pick 10. If it was (1,4), it would always pick 4. And, in this scripts case, it always picks 2, never 1. Am I missing something? Why won't it pick randomly between the two?
*All help is appreciated! *

4 comments
Also, I have no explanation for why that line of code works. All I know is that I had this same issue weeks ago, and this was the solution somebody gave me (and it worked!).
Well, Roblox uses a seed algorithm for creating random numbers as Mine Craft uses a seed to generate it's worlds. And just like Mine Craft, Roblox has a default seed. To change this, put in a different seed. tick() will always be different as tick() returns the local UNIX time, which is the number of seconds since the Unix epoch
The reason it works quite well is because the modulus operator (%) is pulling the preceding decimal digits from tick(), which is incredibly precise. Then it multiplies it by the SN of 1,000,000, which moves them to their respective unit place.
In other words, it uses the precision of tick() by converting it's nth decimal place into a whole number.