I need help with math.random

You can write your topic however you want, but you need to answer these questions:

1. What do you want to achieve? Keep it simple and clear!
What I want to achieve is getting a different print once the night is over

2. What is the issue? Include screenshots / videos if possible!

3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried using break and return but I’m not smart enough to know on how to use return. I also looked in the Dev Hub but I couldn’t find any solutions.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

``````local eventsChance = math.random(1, 5)
-- The Script
while true do
wait(5)
if game.Lighting:GetMinutesAfterMidnight() > 6.25 * 60 and game.Lighting:GetMinutesAfterMidnight() < 17.625 * 60 then
print("It's morning time!")
day1_color:Play()
day2_brightness:Play()
day3_exposure:Play()

clouds1:Play()
clouds2:Play()

vision1:Play()
vision2:Play()

water:Play()
end
if game.Lighting:GetMinutesAfterMidnight() > 17.75 * 60 then
print("It's night time!")
if eventsChance == 1 then
print("Pumpkin Moon")

elseif eventsChance == 2 then
print("Blood Moon")

elseif eventsChance == 3 then
print("Short Vision")

elseif eventsChance == 4 then
print("Darkness")

elseif eventsChance == 5 then
print("Nothing")

end
end
end`````````

make it run every single time the event starts, it runs once at the start of the script

``````if game.Lighting:GetMinutesAfterMidnight() > 17.75 * 60 then
print("It's night time!")
local eventsChance = math.random(1, 5)``````
2 Likes