Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make an event run every 2-5 minutes?

Asked by 2 years ago

I'm trying to make an event happen every 2-5 minutes. How would I do that? In my game,a random event will run every 2-5 minutes, but I don't know how to even begin.

0
Hey! What Event are you talking about? a event that happens world wide or a event you activate in studio? YoungsterJeremy1 6 — 2y
0
Sorry I didn't really explain the event that happens world wide, The event is automatically on YoungsterJeremy1 6 — 2y
0
Is it a RemoteEvent? NotThatFamouss 605 — 2y
0
If you're talking about an event as in like tacos falling from the sky then could you please list every single event you're talking about. Clooouudy 20 — 2y
View all comments (2 more)
0
Well it's more of just a random thing that happens. Like for example, a knife might pop up somewhere,or a door might open. That's what I mean by event. Carlowskey 20 — 2y
0
I've created the map,the atmosphere and all. Every couple of weeks I would update it to add more "events" that will happen every 2-5 minutes. Carlowskey 20 — 2y

1 answer

Log in to vote
0
Answered by
AronYstad 101
2 years ago

I'm not entirely sure what you mean, but this might work:

while condition do
    wait(math.random(120,300))
    event
end

Replace "condition" with whatever condition it is, and replace "event" with whatever event you're trying to fire. If you don't want it to run all the time, you could put the while loop in a function that fires at a certain point (for example when the condition in the while loop is met).

Ad

Answer this question