Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

math.random trouble. Frame doesn't show up with variables. ???

Asked by 6 years ago

When I insert a variable into the math.random() code such as "math.random(100)" my frame/image will not show up but when I leave the variable box open () it shows up and the code works. It only works WITHOUT a variable "math.random()".

0
Im pretty sure you need two variables, and math.random picks between them, such as math.random(1,100) ZeMeNbUiLdEr 104 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

math.random() requires two arguments: The start point and end point, so to speak.

local number = math.random(1,100)
print(number)

number's value will be selected randomly between 1 and 100.

Ad
Log in to vote
0
Answered by
GingeyLol 338 Moderation Voter
6 years ago

local min = 1 local max = 5 print(math.random(min,max))

Answer this question