|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 May 2014 12:17 PM |
| Oh, then just add a simple debounce |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
| |
|
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
|
  |
| 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 |
|
|
|
| 24 May 2014 12:46 PM |
| Im sorry, but i have no idea what you mean D: |
|
|
| Report Abuse |
|
|
|
| 24 May 2014 01:04 PM |
| I setted it to true, and it gave the same Error... Help D: |
|
|
| Report Abuse |
|
|