You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I am trying to make a game like Observation Duty and I already made the camera work but I want to make random events happen every random amount of seconds. For example, lets say the random amount of time chosen is 31 seconds and the random event chosen to happen is for the table to disappear. The next random amount of time chosen is 47 seconds and the random event chosen to happen is for the box to float.
-
What is the issue? Include screenshots / videos if possible!
I don’t have a clue on how to do this.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
None because I don’t have a clue on how to do this.
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!
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
1 Like
Store the functions that perform different tasks into a table.
Use math.random to pick a random index which has a function.
local Events = {}
function Events.func()
print("Hello")
end
function Events.func1()
print("Hi")
end
Events[math.random(1,#Events)]
This should give you some hint I hope.
4 Likes
Thank you for the help. I have tried making tables and looping through them but if I made the box disappear, how would I clone it and put it back to where it was before it got destroyed?
Before another event and time is chosen can’t you make the box appear again?
how would I clone it and put it back to where it was before it got destroyed?
I am sure you can store the object’s position in a variable.
After the time is over clone another box from wherever you stored it into that position.
Would that be the most efficient way possible?
What else solutions can you think of?
If you have any try implementing them and check the efficiency and code.
I would say this is pretty simple.
In summary this is like
Make a random event happen.
After the event ends do whatever you would like.
Start another round for an event to occur.
What about making the random time?
I have given a script which shows how to choose a random function.
The same way you can choose an object,number,string,bool etc.
Okay thank you for your replies. Also, have you played or seen Observation Duty?
Honestly, I did not hear of this game, it’s the first time.
Oh well I am basing my game off that game like a paradoy of it. Do you know if I would get copyrighted for making a Roblox game off of it?
I am pretty sure if it is not the exactly the same looking it won’t cause any problems
Okay thank you! I marked your responses as solution.