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

My game is really laggy at certain events?

Asked by
RM0d 305 Moderation Voter
9 years ago

Not a coding question but a practice question, what is the best way to write loops ( been using i,v in pairs) and is using module scripts laggy. Also what is the best way to eliminate lag from unknown problems(finding them and fixing them), Thank you

0
Using module scripts should be no more laggy than using regular scripts to do the same thing. chess123mate 5873 — 9y

2 answers

Log in to vote
1
Answered by 9 years ago

In roblox studio under view there is a script performance window which will help you find which script are lagging.

Also I haven't tested this but splitting all of the scripts apart may help to spread the workload so that all of the work is not being done by one or two scripts.

hope this helps

0
IF I use this and slove the problem I will accept the answer. I believe my game is optimize and I have one leak in the code RM0d 305 — 9y
0
It is my playerlist it seems to be calling stuff lots of times when not needed, So I delayed it and removed update theards and it seems to work perfectly and lag has stoped. Thanks :D ACCEPTED ANSWER RM0d 305 — 9y
0
Not a problem happy coding :P User#5423 17 — 9y
1
Splitting up scripts will not "spread the workload". In the end, the same work will have to be done (technically a bit more because each script adds at least one coroutine, but I imagine that's negligible). chess123mate 5873 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

For loops, I suggest you read this

Another thing to take note is the Spawn function and coroutines. Using separate threads instead of just one may improve the performance in your scripts.

0
Using additional coroutines won't improve the performance of your script. Coroutines do not run in parallel. TheLuaWeaver 301 — 9y

Answer this question