yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 13 May 2014 01:24 PM |
Okay so I got this and it works perfectly fine in testmode but it doesn't do anything at all in a normal server, does anyone know what is the problems Thing to know: -This is in a localscript -This is inside startergui
----------------------------------------------------------------
player = game.Players.LocalPlayer system = game.workspace.system
function onDeath() system.playersalive.Value = system.playersalive.Value -1 player.CameraMode="Classic" system.joindeadmsg.Value = player.Name .. " has died." end
player.Character.Humanoid.Died:connect(onDeath)
|
|
|
| Report Abuse |
|
|
|
| 13 May 2014 01:49 PM |
| insert the script into the character or into playergui DURING the game |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 01:50 PM |
local player = game.Players:WaitForChild('LocalPlayer');
|
|
|
| Report Abuse |
|
|
yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 13 May 2014 02:06 PM |
@Verified
thought that would fix it, but it didn't for some reason.. |
|
|
| Report Abuse |
|
|
yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
| |
|
|
| 13 May 2014 02:36 PM |
To test it as if it's a normal server;
For old studio: Start a server, then start as many players as you would like. (From the place not from the server)
For new studio (Ribbon bar) Click the 'Test' ribbon, and at the right select the drop down menu. Select how many players you would like to test, and click 'Start'
After you do this tell us the output. |
|
|
| Report Abuse |
|
|
yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 13 May 2014 02:48 PM |
OUTPUT: 14:46:41.106 - Players.Player1.PlayerGui.maingui.ondead:10: attempt to index field 'Character' (a nil value) 14:46:41.106 - Stack Begin 14:46:41.107 - Script 'Players.Player1.PlayerGui.maingui.ondead', Line 10 14:46:41.108 - Stack End |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 02:51 PM |
The script is most likely running before the character is even added, you can fix this with an if.
|
|
|
| Report Abuse |
|
|
yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 13 May 2014 03:13 PM |
| and where should I put this "if" |
|
|
| Report Abuse |
|
|
yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 13 May 2014 03:49 PM |
| Cmon how can I make it wait for the character to load? |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 03:51 PM |
| Using PlayerAdded, clone the script into the player. It's beacuse it's executing before the character is there |
|
|
| Report Abuse |
|
|
yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 13 May 2014 04:12 PM |
| i'm sure there must be a easier way to do it than cloning it to each player.. |
|
|
| Report Abuse |
|
|
| |
|
yoshiwars
|
  |
| Joined: 27 Jul 2009 |
| Total Posts: 216 |
|
|
| 13 May 2014 04:31 PM |
I tried this player = game.Players:WaitForChild('LocalPlayer') but it didnt seem to work |
|
|
| Report Abuse |
|
|
|
| 13 May 2014 04:35 PM |
LocalPlayer will always be there, since the Backpack and/or PlayerGui scripts will only fire when the player is there. The things you have to wait for are things like Character and Humanoid. Like this
if game.Players.LocalPlayer.Character then v.Character:WaitForChild("Humanoid") end |
|
|
| Report Abuse |
|
|