Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you make a random event type script?

I'm wanting to make a type of script where every few minutes something random will happen kinda like natural disaster survival, but I'm not sure where to start.. any ideas?

1 answer

✓ Accepted answer

Yeah. First figure out how to code the event. Then make a function that cycles them every few minutes or something using math.random with a loop.

I would program each event as some sort of function or something to make life easy.

--Need to store our event functions
Events = {EventFunction1,EventFunction2} --etc.

--where an event function might look like:

function EventFunction()
	game.Lighting.TimeOfDay = 0
	wait(30)
	game.Lighting.TimeOfDay = 30
end

--need the loop to run everything.

while wait() do
	Events[math.random(1,#Events)]()
end

This code will not work, it's designed to give you the blocks and understanding you need. That's the principle, good luck figuring out the rest.

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.