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

Math random Problems, when I play the game, it doesn't work?

I have this math random script, that takes a model out of lighting at random, but when I play the game, it always ends up doing one model, instead of a mix of the ones that I have. Does anyone know what's wrong?

value = 0

wait (.05)

value = math.random(1,2)

if value == 1 then game.Lighting.Model1:clone().Parent = game.Workspace if value == 2 then game.Lighting.Model2:clone().Parent = game.Workspace end end

For example when I click play in studio, it might work, but when I actually play the game it ALWAYS does only one of them.

1 comment

1

The problem is based around the seed the RNG uses to produce the random numbers. I've explained it detail here: https://scriptinghelpers.org/questions/35236/mathrandom-isnt-random-question#37769

1 answer

Its purely the seed used. There's an answer somewhere on the wiki that i can't find.

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