• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua [TFS 1.0] Why can't I use math.random onStartup? And how can I get a random number on startup?

Tufte

Member
Joined
Nov 19, 2007
Messages
652
Reaction score
24
Location
Norway
Code:
 function onStartup()
local i = math.random(1, 3)
end

always returns 1, why? is it because the servers timer is always the same when the script loads?

how can I get a random number into my startup script?

thanks
 
then try adding this at the top of the script
Code:
math.randomseed(os.time())
so it Look like this
Code:
 function onStartup()
math.randomseed(os.time())
local i = math.random(1, 3)
end

Thanks :)
 
Back
Top