Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

math.random is only picking 1 map?

I'm trying to pick a map but it keeps picking the same map (I have 1 model that contains 2 maps in replicated storage)

local RS = game:GetService('ReplicatedStorage') --Same thing as saying (game.Lighting)
local Maps = RS.Maps:GetChildren()
local PickMap = math.random(1,#Maps)
local SelectedMap = Maps[PickMap]:Clone()

print(SelectedMap.Name)
SelectedMap.Parent = workspace

1 comment

1

have you tried running it a ton of times? there are only 2 maps

1 answer

✓ Accepted answer

This most likely isn't a bug but is caused by you not changing the seed of the random generator, at the beginning of your script write, math.randomseed(os.time). That makes it so that it uses a different seed each time it generates.

1 comment

0

I'll accept it but not sure if that will work, I am at school atm. I'll try when I get home.

This discussion is preserved as it was. New answers, comments, and votes are closed.