If I remember correctly you need to change the seed each time by setting the math.randomseed().
You need to run math.random within the scope of where you need the variable to be updated. If you call it at the beginning of the script, the value will always be the same.Hello. I have a problem. I have to get a part to move to random positions using math. I typed out "local RandomPosition = math.random(1,5)"
and did some code that would check what the variable would be equal to. But it only would equal the first randomposition. Can you figure out how to get this fixed?
local randomNumber = math.random(1, 5)
for _ = 1, 10 do
print(randomNumber) --> always the same number
end
for _ = 1, 10 do
print(math.random(1, 5)) --> randomized output every iteration
end