Advertisement
booNeibmoZ

"Making a Bomb" Roblox Scripting Tutorial

Jun 28th, 2011
702
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. ==Introduction:==
  2. In this tutorial, you'll be learning how to make an onTouched bomb! Sort of like a mine field type bomb.
  3. ==Setting It Up...==
  4. [[File:TheBomb.png|thumb|144px|The Bomb]]
  5.  
  6. First, go open up Roblox Studio. Next, go to Insert>Object>Part and change the Shape to Ball/Sphere. Then resize it to actually look like a ball. Then select that part. Go to Insert>Object>Script. Name this script and the part whatever you feel is necessary.
  7. ==Scripting It!==
  8. Here, we will learn to script the bomb itself. Let's get started...
  9.  
  10. To see if the bomb is touched to activate, we do this:
  11. function onTouched() --Starts the function so it will activate on touched.
  12. Now, we have our function, sweet! Let's build the explosion:
  13. local e = Instance.new("Explosion") --Creates the explosion
  14. e.Parent = script.Parent --Places location of "Explosion" in the Explorer.
  15. e.Position = script.Parent.Position --Positions explosion to the bomb.
  16. e.BlastRadius = 1000 --Shows how big the explosion will be.
  17. e.BlastPressure = 100000 --How much impact will go into the ranged targets.
  18. end --Ends the funtion so anything you type after doesn't affect it.
  19. We aren't finished yet, though! Let's end our function by putting a new line and an "end" then break another line. On our last line, we are going to connect our function so it works:
  20. script.Parent.Touched:connect(onTouched) --Connects the function so it works
  21. This tells the bomb (script.Parent) that when it's touched that it needs to do something.
  22. ==The finished Script==
  23.  
  24. [[File:EditedExplosion.png|frame|Explosion after the bomb is done.]]We will now show you what the script looks like when it's done.
  25.  
  26.  
  27. function onTouched()
  28. local e = Instance.new("Explosion")
  29. e.Parent = script.Parent
  30. e.Position = script.Parent.Position
  31. e.BlastRadius = 1000
  32. e.BlastPressure = 100000
  33. end
  34.  
  35. script.Parent.Touched:connect(onTouched)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement