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: I'm a noob

Previous Thread :: Next Thread 
Ninjamaniac1 is not online. Ninjamaniac1
Joined: 24 May 2011
Total Posts: 54
07 Jan 2014 04:03 PM
I am learning how to script and this won't work, the brick just dissapears immediatly, can someone explain why?

local brick = Workspace.Brick

if brick:destroy() then
print ("YOU SCARE ME")

end
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Jan 2014 04:04 PM
brick:destroy() that's why
Report Abuse
Ninjamaniac1 is not online. Ninjamaniac1
Joined: 24 May 2011
Total Posts: 54
07 Jan 2014 04:04 PM
What can I do to fix it?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Jan 2014 04:05 PM
I don't know what you want to do.
Do you want to check if it is destroyed? Destroy it then print?
Report Abuse
Ninjamaniac1 is not online. Ninjamaniac1
Joined: 24 May 2011
Total Posts: 54
07 Jan 2014 04:06 PM
I want the script to have the print appear if the brick is destroyed, sort of like the

game.Workspace.Ninjamaniac1.Head:remove()


script. where it's removed
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Jan 2014 04:07 PM
local brick = Workspace.Brick

if brick == nil then
print ("YOU SCARE ME")
else
print ("THE BRICK EXISTS")
end
Report Abuse
Ninjamaniac1 is not online. Ninjamaniac1
Joined: 24 May 2011
Total Posts: 54
07 Jan 2014 04:07 PM
What would that script do? exactly
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Jan 2014 04:08 PM
If it doesn't exist it will print that, otherwise it will print it does exist
Report Abuse
Ninjamaniac1 is not online. Ninjamaniac1
Joined: 24 May 2011
Total Posts: 54
07 Jan 2014 04:09 PM
Thank's for the help! I appreciate a veteran scripter helping a newbie!
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
07 Jan 2014 04:10 PM
In case it is nil, you should actually have done this:
local brick = Workspace:FindFirstChild("Brick")
Otherwise it will error if it is nil on that line
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