Advertisement
astronaut32

orb

Jul 7th, 2015
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. name = "PabloRV"
  2. player = game.Workspace["PabloRV"]
  3. m = Instance.new("Model") m.Parent = player m.Name = "" .. name .. "'s Orb"
  4. p = Instance.new("Part") p.Parent = player["" .. name .. "'s Orb"] p.Size = Vector3.new(2,2,1) p.BrickColor = BrickColor.new("Cyan")  p.Material = ("Neon") p.Position = Vector3.new(0,20,0) p.Name = "Head"
  5. h = Instance.new("Humanoid") h.Parent = player["" .. name .. "'s Orb"] h.MaxHealth = 0 h.Health = 0
  6. b = Instance.new("BodyPosition") b.Parent = player["" .. name .. "'s Orb"].Head b.maxForce = Vector3.new(10000000,10000000,10000000)
  7. local tool = script.Parent
  8. local user
  9.  Instance.new("Tool",game.Players.PabloRV.Backpack)game.Players.PabloRV.Backpack.Tool.Name = ("orb blaster")
  10. local tool = game.Players.PabloRV.Backpack["orb blaster"]
  11. while true do
  12. b.position = player.Head.Position + Vector3.new(0,3,5)
  13. wait()
  14. end
  15. Instance.new("Script",game.Workspace.PabloRV["orb blaster"])
  16. Instance.new("StringValue",game.Players.PabloRV.Backpack["orb blaster"])game.Players.PabloRV.Backpack["orb blaster"].Value.Value = (tool.Equipped:connect(function(mouse)
  17.     --store the character of the person using the tool
  18.     user = tool.Parent
  19.  
  20.     --when the left mouse button is clicked
  21.     mouse.Button1Down:connect(function()
  22.         --make and do a hit test along the ray
  23.         local ray = Ray.new(player["Player's Orb"] (mouse.Hit.p - tool.Handle.CFrame.p).unit*300)
  24.         local hit, position = game.Workspace:FindPartOnRay(ray, user)
  25.  
  26.         --do damage to any humanoids hit
  27.         local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid")
  28.         if humanoid then
  29.             humanoid:TakeDamage(10)
  30.         end
  31.  
  32.         --draw the ray
  33.         local distance = (position - tool.Handle.CFrame.p).magnitude
  34.         local rayPart = Instance.new("Part", player["Player's Orb"].Head)
  35.         rayPart.Name          = "RayPart"
  36.         rayPart.BrickColor    = BrickColor.new("Cyan")
  37.         rayPart.Transparency  = 0.5
  38.         rayPart.Anchored      = true
  39.         rayPart.CanCollide    = false
  40.         rayPart.TopSurface    = Enum.SurfaceType.Smooth
  41.         rayPart.BottomSurface = Enum.SurfaceType.Smooth
  42.         rayPart.formFactor    = Enum.FormFactor.Custom
  43.         rayPart.Size          = Vector3.new(0.2, 0.2, distance)
  44.         rayPart.CFrame        = CFrame.new(position, tool.Handle.CFrame.p) * CFrame.new(0, 0, -distance/2)
  45.  
  46.         --add it to debris so it disappears after 0.1 seconds
  47.         game.Debris:AddItem(rayPart, 0.1)
  48.     end)
  49. end)
  50. )
  51. source = script.Parent:FindFirstChild("Source")
  52. if source then
  53. loadstring(source.Value)() --Loads the code from the StringValue
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement