Question about math.random

Hey there!

Is it possible to set a number lets say ‘8’ for example, and if you were to do math.random(1, 10) then if it were to pick ‘8’ then the script would run specific code such as printing hello, etc.

Let me know, thanks!

1 Like
if math.random(1,10) == 8 then
    --Your code here
end
1 Like
local number = math.random(1, 10)

if number == 8 then
    print("hello")
end

I don’t think I need to explain this

1 Like