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
 

Re: How the heck is 'x' a nil value?

Previous Thread :: Next Thread 
TutorialBlox is not online. TutorialBlox
Joined: 01 Apr 2010
Total Posts: 1586
05 Oct 2013 01:57 PM
I am trying to get this simple script to work, but it just wont! What am I doing wrong here?
--------------------------------------------------------------------------------------------------------
function onTouch(hit)
local x = hit.Parent:FindFirstChild("Body Colors")

if (x.Name == "Contestant")then
x.Name = "Body Colors"

else if (x.Name ~= "Contestant") then
hit.Parent:FindFirstChild("Humanoid").Health = 0

end

end

end

script.Parent.Touched:connect(onTouch)
Report Abuse
gansest is not online. gansest
Joined: 08 Apr 2010
Total Posts: 609
05 Oct 2013 02:00 PM
No idea why you are using Contestant here: if (x.Name == "Contestant")then
BUT...
x is the Body Colors. use

if x ~= nil then instead of using x.Name checking.
Report Abuse
TutorialBlox is not online. TutorialBlox
Joined: 01 Apr 2010
Total Posts: 1586
05 Oct 2013 02:02 PM
I think I get it... but your words are a bit jumbled. So what do I put instead of Name?
Report Abuse
gansest is not online. gansest
Joined: 08 Apr 2010
Total Posts: 609
05 Oct 2013 02:04 PM
Your scripts makes the player DIE every times the player steps on. What's the idea?
Report Abuse
TutorialBlox is not online. TutorialBlox
Joined: 01 Apr 2010
Total Posts: 1586
05 Oct 2013 02:05 PM
Ohhhhhhhhhhhhhhhhhhhhhhhhh... Darn, Just noticed my problem... lol I switched Body Colors with the name of contestant...
Report Abuse
TutorialBlox is not online. TutorialBlox
Joined: 01 Apr 2010
Total Posts: 1586
05 Oct 2013 02:06 PM
I'm good now, thanks though for the help :)
Report Abuse
gansest is not online. gansest
Joined: 08 Apr 2010
Total Posts: 609
05 Oct 2013 02:06 PM
Alright. If you need something else-- PM me
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