generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Making a Region3 with every Heartbeat() ineffecient?

Previous Thread :: Next Thread 
Alkameltzer is online. Alkameltzer
Joined: 11 Jan 2015
Total Posts: 1373
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 is online. 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
PhantomVisual is not online. PhantomVisual
Joined: 08 Apr 2011
Total Posts: 2025
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
Alkameltzer is online. Alkameltzer
Joined: 11 Jan 2015
Total Posts: 1373
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
EagleFireClaw is not online. EagleFireClaw
Joined: 27 Dec 2014
Total Posts: 498
02 Oct 2017 08:34 PM
while true do return end


roblox.Forum["Let's Make A Deal"]:ClearAllChildren()
Report Abuse
WoolHat is online. 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
Alkameltzer is online. Alkameltzer
Joined: 11 Jan 2015
Total Posts: 1373
02 Oct 2017 08:37 PM
Locating interactable objects near the player
Report Abuse
KingKamII is online. 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
Alkameltzer is online. Alkameltzer
Joined: 11 Jan 2015
Total Posts: 1373
02 Oct 2017 08:38 PM
I dont want to find the magnitude between 50 different things, region3whitelist is much easier
Report Abuse
Laedere is online. 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 is online. 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
Alkameltzer is online. Alkameltzer
Joined: 11 Jan 2015
Total Posts: 1373
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 is online. 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
Alkameltzer is online. Alkameltzer
Joined: 11 Jan 2015
Total Posts: 1373
02 Oct 2017 08:44 PM
I'll just put a cooldown in the function so it cant run that fast
Report Abuse
Alkameltzer is online. Alkameltzer
Joined: 11 Jan 2015
Total Posts: 1373
02 Oct 2017 08:45 PM
Coroutine? Guess i gotta go wiki that
Report Abuse
orange451 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image