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

Help? in my Tycoon Droppers continue dropping at the same speed during lag [closed]

Asked by 8 years ago

I'm making a tycoon with Fvii's tycoon kit, and I've made it to the point where theres so many droppers that if a clog happens, the dropped parts slow down, but the droppers still drop, cause more parts to appear. Thus the game lags and the drops dont make it to the collector. I need help making a script that every 120 seconds any parts named "DroppedPart" that have been in the workspace for less than 20 seconds will get removed.

Any help writting the script would be apreciated, thank you for your cooperation.

Closed as Not Constructive by Azmidium and BlueTaslem

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 8 years ago

You should really try to learn some scripting yourself and try to get a prototype working before posting here. However I'll offer 2 ideas for writing your code:

The first option is the debris service. It has a method called :AddItem(item, lifetime). It will automatically delete item after lifetime seconds have passed.

The second option is to use the delay(t, func) function. This will automatically fire function func after t seconds have passed. If you let function be one that deletes each part for you, you can accomplish your goal.

You mentioned, however, that you want the script to only delete parts every 120 seconds. In that case, I will direct your attention to option 2. This time, let t be 20, and let your function add the part to a table. On a separate loop, every 120 seconds, go through this table and delete everything in it.

Try to get a working prototype using these ideas and come back if you have questions. Perhaps you can even think of another way to script this, which would make this a much more beneficial exercise for you.

Hope this helps!

Ad