Advertisement
Guest User

Explosion code

a guest
Feb 6th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1. local fireball = script.Parent
  2.  
  3. fireball.Touched:connect(function(object)
  4. if object.Parent:FindFirstChild('Humanoid') then
  5. local explosion = Instance.new('Explosion', object)
  6. explosion.BlastRadius = 100
  7. object.Parent.Humanoid.Health = 0
  8. end
  9. end)
  10.  
  11. while true do
  12. local a = fireball:Clone()
  13. a.Parent = game.Workspace
  14. a.Position = fireball.Position
  15. a.Velocity = Vector3.new(0, math.random(50, 300), 0)
  16. wait(0.1)
  17. end
  18.  
  19.  
  20.  
  21. --- TEST IT NOW!!!!!! Oh yeah, if you want the plates to be invisible, change its transparency to 1.
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. --[[
  29. Since we want this to go on forever, we're going to use a while loop. If you don't want it to go on forever,
  30. use a for loop like this: The 10000000000 means that's how many explosive ba---that sounds wrong. explosive
  31. spheres will appear. XD lmfao k But for now, we'll be using a while loop.
  32.  
  33. We use while true do so it'll go on forever :D
  34. We clone the fireball. And we make its parent Workspace so that it exists with everything else.
  35. We position it where the fireball is to be a bit more specific, but here comes a bit of a tricky part.
  36. So, to simplify, a Vector3 is a grouping of 3 numbers. It's a bit more complex than that, but that should do it
  37. for now.
  38. Now, the first number is the X-axis. The second is the Y-axis, and the third is the Z-axis. We made the Y-axis
  39. velocity a number inbetween 50 and 300 with math.random. The PC will pick a number between 50 and 300. That's
  40. how much upwards it will go. Remember, this is a loop! So we're going to need to add in a wait command!
  41. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement