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 » Scripting Helpers
Home Search
 

Re: Break Joints Script causes Massive Lag

Previous Thread :: Next Thread 
planesoldier is not online. planesoldier
Joined: 26 Sep 2010
Total Posts: 533
24 May 2014 12:11 PM
Hey There!

I have Survive the Lava Waves Game and the Lava uses a script to Break the Joints of Buildings, so they collapse. But when this happends, it causes Massive Lag. This is my Script:

function onTouched(hit)
hit:BreakJoints()
end
connection = script.Parent.Touched:connect(onTouched)

Is there a Way to Fix the Lag??? Becouse what it does now it keeps Breaking them, also when they are already broken. I think that causes the lag. But how do i fix that???

Thanks,
Planesoldier
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
24 May 2014 12:13 PM
Just make this your code:
local hit = script.Parent.Touched:wait();
hit:BreakJoints()

It will make the event only run once
Report Abuse
planesoldier is not online. planesoldier
Joined: 26 Sep 2010
Total Posts: 533
24 May 2014 12:15 PM
But then it doesnt brake everything it hits D:. But if this is the only way to fix this, i will do that :l
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
24 May 2014 12:17 PM
Oh, then just add a simple debounce
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
24 May 2014 12:18 PM
Here:

while true do
local hit = script.Parent.Touched:wait();
hit:BreakJoints()
wait(0.1) --debounce of .1 second
end
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
24 May 2014 12:20 PM
Why not disconnect?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
24 May 2014 12:24 PM
Because it seems pretty inefficient to have to keep connecting and disconnecting instead of just returning.
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
24 May 2014 12:26 PM
I understand now.

I ment to disconnect at end of round. - but destroy does this.



Cant you just put a value true and check if true then break joints?
Report Abuse
planesoldier is not online. planesoldier
Joined: 26 Sep 2010
Total Posts: 533
24 May 2014 12:46 PM
Im sorry, but i have no idea what you mean D:
Report Abuse
planesoldier is not online. planesoldier
Joined: 26 Sep 2010
Total Posts: 533
24 May 2014 01:04 PM
I setted it to true, and it gave the same Error... Help D:
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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