golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
|
| 28 Feb 2015 02:39 PM |
| I thought my place was working fine last time i played it, but i haven't been on it for a few weeks. I went to see if it was still working and now there is random stuff not working and bugs. Did a recent update break something with scripts? |
|
|
| Report Abuse |
|
|
golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
|
| 01 Mar 2015 03:01 PM |
This is so messed up. It seems like the roblox engine is inconsistent or something. I have this part of a script where when someone dies, a local variable creates a clone of a gui (inside the function that is called so there is always a new clone copy created each time), then a few seconds later it destroys the old copy and pastes in the new one created by the clone. But once in awhile it does not give the player the copy. It appears to be completely random, no pattern to it once so ever. Any way to prevent this from happening or does it have to do with the roblox engine?
P.S. there is no wait time between the line that destroys the old one and the line that gives the player the copy, would this happen to be the problem? |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 03:03 PM |
| Check the output to see if there is an error. And yes, that is probably the problem. I would refrain from destroying the old one since GUIs reset on death anyways, then just copy the new one when they spawn. |
|
|
| Report Abuse |
|
|
DPLX
|
  |
| Joined: 10 Dec 2014 |
| Total Posts: 768 |
|
|
| 01 Mar 2015 03:04 PM |
Updates don't break scripts, your faulty code changes when new things are changed. If your code was decent enough, ROBLOX updates wouldnt be able to break it.
Post your code here please
:) |
|
|
| Report Abuse |
|
|
golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
|
| 01 Mar 2015 03:10 PM |
| i used a print function to make sure it recognized the clone, and it did but sometimes it wouldn't give the player a copy. I'll post the lines in a minute |
|
|
| Report Abuse |
|
|
golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
|
| 01 Mar 2015 03:18 PM |
here is the script:
when a player dies I have a local gui script with a function that triggers when a the player's health changes and it checks if the health is == 0, if it is then it triggers a remote function named "Respawn" which is placed in a model in the Workspace with other remote functions stored.
game.Workspace.GuiRemoteEvents.Respawn.OnServerEvent:connect(function(player) local servermessaging = script.ServerGuiBar:Clone() ---Ignore this chunk, it just deletes the person from the list of racers in the match--- if #positions >0 then for x = 1,#positions do if positions[x] == player.Name then table.remove(positions, x) end end end ---------------------------------------------------------------------------- repeat wait() until game.Players:FindFirstChild(player.Name).Character.Humanoid.Health > 0 wait(3) game.Players:FindFirstChild(player.Name).PlayerGui.ServerGuiBar:Destroy() servermessaging.Parent = game.Players:FindFirstChild(player.Name).PlayerGui end)
I added a .1 wait time between the deleting and the adding and it still failed after I resetted 6 times lolz. Do i need to add longer waits or add more waits to my scripts?
If you have any tips/ tricks advice on how I can make sure my scripting is more robust, I'm willing to learn how I can script stuff so I can be sure the scripts work after they run over thousands of times and/or not break on a very laggy server. Thank your for any and all advice/ help |
|
|
| Report Abuse |
|
|
golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
|
| 01 Mar 2015 03:40 PM |
| k, i deleted the line that destroyed it since the gui is automatically destroyed on death, still doesnt work every time =P every 3-5 times it breaks |
|
|
| Report Abuse |
|
|
golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
| |
|
golfercab
|
  |
| Joined: 26 Sep 2011 |
| Total Posts: 714 |
|
|
| 03 Mar 2015 03:49 PM |
After ALOT more experimentation, i figured out what was going on. Keep in mind, when a player dies/resets it deletes all player guis and equips them with the starter guis. Well, it would get to the line of code that pastes the gui into the player BEFORE the server even renewed the player's guis. So what was happening was the script gave the player a gui (i make a script do this because i have filtering enabled on and this is the only way the server will know this gui exists in the players and is allowed to manipulate it), but after it gave the player the gui, the server erased the players guis and gave them the guis in the starter gui pack. Since I made the script give the player this, and the gui was not in starter guis, the player would not have it.
This only happened once in awhile because it all depends on how fast the character was reloaded. |
|
|
| Report Abuse |
|
|