n = math.random(1, 24)
print("number is" ..n)
while true do
wait(0.01)
if game.Lighting.ClockTime == n then
game.ServerScriptService.Rain:Clone().Parent = game.Players.LocalPlayer.Backpack
n = math.random(1,24)
print("number is " ..n)
break
end
end
COMMUNITY QUESTION
Math.Random() isnt working for me?
1 answer
The problem is that for you is that math.random is based on the number you got before. Thats why IT always Will return the same Value IF its not running more then once.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
It works, just check your 'ClockTime' line, does ClockTime returns whole number? . 1-24 ? I've never used ClockTime before tho
use "math.randomseed(tick())" at the start of your scriot and only the start
I notice you print
nbut you aren't printingClockTime. Try printingClockTimeand I think you will see the problem.Also, make
na local variable by making the first line havelocal ninstead ofn