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! *
Roblox is bad in many ways, we all know that. This is one of those ways. You have to call a different random event first to basically set up the script to do, well, random things. Try this:
As the first line of your script, put this line of code I was given a few weeks ago. Don't edit it at all. It should fix your math.random() issues:
math.randomseed(tick()%1*1e6)