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

how do i put a minimum number for math.random?

look i tryed here

local number = math.random() *5 >3
print (number)

L--> false

why did it input: false? how can i finish my code?

1 answer

Your code printed false because your number variable was an expression. The math.random function with no given arguments will return a randomized number between 0 and 1. You multiplied this by 5, then had the expression check whether or not it was greater than 3. Due to this, the variable turned into a bool datatype. If it was greater than 3 then it would be true, if it was less than 3 it would be false.

I think what you were looking for was an if statement.

local number = math.random() * 5 

if number > 3 then
	print (number)
end

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