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 » Scripters
Home Search
 

New to scripting - have the script do nothing?

Previous Thread :: Next Thread 
bloberous is not online. bloberous
Joined: 07 Jun 2009
Total Posts: 299
15 Jul 2016 12:35 AM
What do people use when they want the script to do nothing? Do you just end it? Do you put return? Do I just not include it?

For example:

if hit.Parent.Name = bloberous then
DO NOTHING?
else hit.Parent:findFirstChild'Humanoid'.Health = 0
end

While I think I can do it this way, I still want to know how to tell the script to do nothing at that point.

if hit.Parent.Name ~= bloberous then
hit.Parent:findFirstChild'Humanoid'.Health = 0
end
Report Abuse
Andyliu5000 is not online. Andyliu5000
Joined: 02 Nov 2013
Total Posts: 969
15 Jul 2016 12:38 AM
If hit.Parent.Name ~= "bloberous" then
hit.Parent.Humanoid.Health = 0
End
Report Abuse
xXIcanthinkofanameXx is not online. xXIcanthinkofanameXx
Joined: 05 May 2012
Total Posts: 857
15 Jul 2016 12:40 AM
They don't write any code?
Report Abuse
ninjabeast0117 is not online. ninjabeast0117
Joined: 19 Dec 2011
Total Posts: 489
15 Jul 2016 12:47 AM
if hit.Parent.Name == bloberous then
hit.Parent:findFirstChild'Humanoid'.Health = 100
else
hit.Parent:findFirstChild'Humanoid'.Health = 0


this is how i'd do that. but i don't know how to make it do nothing.
Report Abuse
FireController1847 is not online. FireController1847
Joined: 17 Jan 2013
Total Posts: 1828
15 Jul 2016 12:50 AM
No, instead of doing that, you can do this.

if not hit.Parent.Name = bloberous then
hit.Parent:findFirstChild'Humanoid'.Health = 0
end

But yes, you can do nothing. It won't break the script in any way, it's just not efficient and not recommended.

For functions, you can either do nothing or you can just do return, which in terms will end the function.

function Function()
if hit.Parent.Name == bloberous then
return
else
hit.Parent:findFirstChild'Humanoid'.Health = 0
end
end


#code function brag() print("R$691") end
Report Abuse
StraightOuttaHoenn is not online. StraightOuttaHoenn
Joined: 10 Jun 2016
Total Posts: 86
15 Jul 2016 12:52 AM
if not hit.Parent.Name or hit.Name = bloberous then
hit.Parent:findFirstChild('Humanoid').Health = 0
else
return
end


Report Abuse
bloberous is not online. bloberous
Joined: 07 Jun 2009
Total Posts: 299
15 Jul 2016 12:54 AM
Yeah I just tried return and it works.

There's just something in my brain that goes "make it do nothing when this happens and do this when this happens" instead of "if this doesn't happen, do this".
Report Abuse
FireController1847 is not online. FireController1847
Joined: 17 Jan 2013
Total Posts: 1828
15 Jul 2016 12:56 AM
Hey, we all prefer what we like. Glad you found something you like. :)


#code function brag() print("R$691") end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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