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
 

I can not enter my name into this script.

Previous Thread :: Next Thread 
11headeddragon is not online. 11headeddragon
Joined: 21 Mar 2011
Total Posts: 117
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 is not online. 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 is not online. 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 is not online. 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
LoveableGirlXD is not online. LoveableGirlXD
Joined: 18 Feb 2014
Total Posts: 429
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
LoveableGirlXD is not online. LoveableGirlXD
Joined: 18 Feb 2014
Total Posts: 429
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 is not online. 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
minminopop is not online. minminopop
Joined: 27 Apr 2012
Total Posts: 1030
30 Mar 2014 01:05 PM
Use repeat wait() until player to wait for player.
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