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: umg h4x

Previous Thread :: Next Thread 
Catpwnszer is not online. Catpwnszer
Joined: 26 Nov 2010
Total Posts: 631
17 Feb 2012 11:50 AM
So what I'm trying to do is I have a button, right? So if a car hits the button it prints "Car". If anything else hits it, it prints "Error". The script can tell if it's a car since the car has a vehicle seat. Here's my code could someone make it work and make it tidier?

function carwash(hit)
local h = hit.Parent:findFirstChild("VehicleSeat")
if h then
local per = hit.Parent:findFirstChild("Humanoid")
if not per then
print("Coding goes here")
else
print("Error")
end end end

script.Parent.Touched:connect(carwash)
Report Abuse
Seranok is not online. Seranok
Joined: 12 Dec 2009
Total Posts: 11083
17 Feb 2012 11:52 AM
if hit.Parent is nil then the event will be disconnected and the button won't work anymore.
Report Abuse
Catpwnszer is not online. Catpwnszer
Joined: 26 Nov 2010
Total Posts: 631
17 Feb 2012 11:55 AM
I don't get what your saying. :P
Report Abuse
Seranok is not online. Seranok
Joined: 12 Dec 2009
Total Posts: 11083
17 Feb 2012 11:57 AM
1. A bullet hits your button.
2. The bullet has a script inside it which deletes the bullet on impact.
3. The button's script assumes the bullet has a parent (which isn't true in this case)
4. The function errors
5. Your button breaks
Report Abuse
Catpwnszer is not online. Catpwnszer
Joined: 26 Nov 2010
Total Posts: 631
17 Feb 2012 12:08 PM
You my kind sir, make no sense. All I'm trying to do is make a carwash. The script drives the car if the car hits the sensor. I can do that easily. But if a a person or some other object hits the button it errors out and the script breaks. Nothing you've said has any relevance once so ever. :P

Bullets? FTW!
Report Abuse
Catpwnszer is not online. Catpwnszer
Joined: 26 Nov 2010
Total Posts: 631
17 Feb 2012 03:32 PM
Someone help pl0x!
Report Abuse
Woodstauk4 is not online. Woodstauk4
Joined: 27 Dec 2010
Total Posts: 3061
17 Feb 2012 03:41 PM
[ Content Deleted ]
Report Abuse
Catpwnszer is not online. Catpwnszer
Joined: 26 Nov 2010
Total Posts: 631
17 Feb 2012 05:35 PM
Thanks. I didn't use that exact code as that wouldn't work but I used the nil part and it works. :D
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