|
| 02 Oct 2017 08:30 PM |
Would that generate a lot of unnecessary lag?
With every Heartbeat I am making a region3 and using FindPartsInRegion3WithWhiteList
Tell me this is fine right? |
|
|
| Report Abuse |
|
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 02 Oct 2017 08:31 PM |
Lots of lag
http://wiki.roblox.com/index.php?title=API:Class/RunService/Heartbeat
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2017 08:32 PM |
I used while true do wait() end (every 1/30th of a second) and it seems to work fine. I just started working with them so unsure what is efficient/inefficient.
|
|
|
| Report Abuse |
|
|
|
| 02 Oct 2017 08:33 PM |
I'm aware how often it fires
but since its local, if it does cause lag, it's rate will slow down with the framerate, giving it time to catch up/stop lag.
Dunno. |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2017 08:34 PM |
while true do return end
roblox.Forum["Let's Make A Deal"]:ClearAllChildren() |
|
|
| Report Abuse |
|
|
WoolHat
|
  |
| Joined: 19 May 2013 |
| Total Posts: 1873 |
|
|
| 02 Oct 2017 08:36 PM |
| Region3s are generally pretty resource-intensive. What are you trying to do with it? There's almost always a better alternative |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2017 08:37 PM |
| Locating interactable objects near the player |
|
|
| Report Abuse |
|
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 02 Oct 2017 08:38 PM |
Can't you use magnitude for that?
while true do wait() --Code end
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2017 08:38 PM |
| I dont want to find the magnitude between 50 different things, region3whitelist is much easier |
|
|
| Report Abuse |
|
|
Laedere
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
|
| 02 Oct 2017 08:39 PM |
Realistically you don't need to check every heartbeat. In my opinion, checking every second/half second would work just as well as using heartbeat.
|
|
|
| Report Abuse |
|
|
KingKamII
|
  |
| Joined: 21 Oct 2016 |
| Total Posts: 471 |
|
|
| 02 Oct 2017 08:40 PM |
Oh sorry. I didn't know how much you were searching for. But just try:
while true do wait() --code end
Though it might still cause lag with other resource-intensive scripts in your game
A wise man once told me that life is a mirror... |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2017 08:43 PM |
| Yeahhh but the problem is, is that I am trying to put it in a function so I can have everything in 1 big script. |
|
|
| Report Abuse |
|
|
Laedere
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
|
| 02 Oct 2017 08:44 PM |
just create a co-routine that loops every half second
|
|
|
| Report Abuse |
|
|
|
| 02 Oct 2017 08:44 PM |
| I'll just put a cooldown in the function so it cant run that fast |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2017 08:45 PM |
| Coroutine? Guess i gotta go wiki that |
|
|
| Report Abuse |
|
|
orange451
|
  |
| Joined: 21 Aug 2008 |
| Total Posts: 580 |
|
|
| 03 Oct 2017 09:16 AM |
If it's done in a local script, you could just measure the performance yourself.
local StartTime = tick(); -- Do logic print( ((tick()-StartTime)*1000) .. " ms" ); |
|
|
| Report Abuse |
|
|
Lykaon
|
  |
| Joined: 27 Oct 2014 |
| Total Posts: 784 |
|
|
| 03 Oct 2017 09:24 AM |
spawn works too
and yeah don't need check every heartbeat. Obviously no ones gonna teleport within that one second to a interactive object and find it non-interactive |
|
|
| Report Abuse |
|
|