hello
I have problem with ModuleScript and generated random numbers in ModuleScript
The value is constantly repeating
local promena = {}
-- gain the last second of the current time time
local function ziskatPosledniSekunduAktualnihoCasu()
-- Gaining the current time
local currentTime = os.date("*t")
-- Getting the last second
local lastSecond = tonumber(string.sub(tostring(currentTime.sec), -1))
return lastSecond
end
-- Function to generate random value based on current time
local function generovatNahodnouHodnotu()
-- Getting the last second of the current time
local lastSecond = ziskatPosledniSekunduAktualnihoCasu()
-- NásobenĂ poslednĂ sekundy náhodnĂ˝m ÄŤĂslem v rozsahu od 1 do 500
local seed = lastSecond * math.random(1, 500)
-- Multiplication last second by random number in the range of 1 to 500
math.randomseed(seed)
-- Generating random value in the range of 1 to 500
return math.random(1*lastSecond, 500*lastSecond)
end
promena.hodnota = generovatNahodnouHodnotu() -- Calling a function to generate random value
return promena
I have a question, When does Modulescipt be loaded ???
VideoExample:
thanks in advance
Cody