|
| 30 Mar 2014 04:03 AM |
I recently started scripting, so I went to the roblox wikia and it gave me this. Workspace.USERNAME.Humanoid.Health = 0 Then, when I went to replace USERNAME with 11headeddragon (My name) it keeps giving me errors, however, when I enter my friends name (Denchie1 for example) it works. Help? |
|
|
| Report Abuse |
|
|
Trioxide
|
  |
| Joined: 29 Mar 2011 |
| Total Posts: 32902 |
|
|
| 30 Mar 2014 04:07 AM |
Workspace["11headeddragon"].Humanoid.Health = 0
When a name starts with a number, you need to do that. |
|
|
| Report Abuse |
|
|
compy111
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 583 |
|
|
| 30 Mar 2014 07:17 AM |
player = game.Workspace:FindFirstChild(11headeddragon) if player then player.Humanoid.Health = 0 print(player.Name.." has been killed.") end |
|
|
| Report Abuse |
|
|
compy111
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 583 |
|
|
| 30 Mar 2014 07:18 AM |
Forgot to put your name between these "..." thats important
player = game.Workspace:FindFirstChild("11headeddragon") if player then player.Humanoid.Health = 0 print(player.Name.." has been killed.") end |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2014 07:19 AM |
Better to use the Player service
Player = Game.Players:FindFirstChild(11desecration) If Player then Player.Humanoid.Health = 0 End |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2014 07:20 AM |
Forgot to put your name in quotation Player = Game.Players:FindFirstChild("11headeddragon") If Player then Player.Humanoid.Health = 0 End |
|
|
| Report Abuse |
|
|
compy111
|
  |
| Joined: 02 Apr 2009 |
| Total Posts: 583 |
|
|
| 30 Mar 2014 12:48 PM |
that's not really better. A character does not always exist, a player does. If you run your script while the character is still loading the script will crash. Maybe you should add if humanoid then But then you make your script unnecessarily long |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2014 01:05 PM |
| Use repeat wait() until player to wait for player. |
|
|
| Report Abuse |
|
|