RNG? #1 q&a
Q: how do i make a coin flip? or maybe something else?
A: coin flips are pretty easy, if you understand them. heres the script and the explanation:
math.randomseed(os.time()) -- this is just a better version of math.random().
local flipc = math.random(1, 2) -- flipc is a variable, with math.random being from 1 - 2.
if flipc == 1 then -- these two lines says if the output is 1 then it will print heads.
print("Heads" -- above this, make sure the equal sign is double. for ex: ==
else -- these two lines just say if its not 1, then print Tails.
print("Tails")
end -- this ends the script.
thats all for now! more advanced tutorials coming soon when i get a lil bit better xd
1 Answer
sorry, one more time. if you wanted to use the code, please do not copy this text. only copy the code.
math.randomseed(os.time()) -- this is just a better version of math.random().
local flipc = math.random(1, 2) -- flipc is a variable, with math.random being from 1 - 2.
if flipc == 1 then -- these two lines says if the output is 1 then it will print heads.
print("Heads" -- above this, make sure the equal sign is double. for ex: ==
else -- these two lines just say if its not 1, then print Tails.
print("Tails")
end -- this ends the script.
COPY THIS UP HERE ⇡⇡⇡