Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 15th, 2012  |  syntax: Lua  |  size: 1.46 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. game.Workspace.ChildAdded:connect(function(child)
  2. if child.Name ~= "Ray" then
  3. for _,v in pairs(game.Workspace:GetChildren()) do
  4. if v:FindFirstChild("Humanoid") and v:FindFirstChild("Head") and v:FindFirstChild("Torso") and v:IsA("Model") then
  5. function CastRay(bool,color,tran,collidebool)
  6. while bool do
  7. wait(0.25)
  8. if (v.Torso.Position - game.Workspace.Raycaster.RayPart.Position).magnitude <= 50 or v.Name ~= "TigreBlood" then
  9. local Ray = Ray.new(game.Workspace.Raycaster.RayPart.Position,(v.Torso.Position - game.Workspace.Raycaster.RayPart.Position).unit * 400)
  10. local Hit,Position = game.Workspace:FindPartOnRay(Ray,game.Workspace.Raycaster.RayPart)
  11. if Hit then
  12. if Hit.Parent:FindFirstChild("Humanoid") then
  13. Hit.Parent.Humanoid:TakeDamage(math.random(1,5))
  14. end end
  15. Raylol = Instance.new("Part")
  16. Raylol.Parent = workspace.Raycaster
  17. Raylol.Anchored = true
  18. Raylol.CanCollide = collidebool
  19. Raylol.Transparency = tran
  20. Raylol.BrickColor = BrickColor.new(color)
  21. Raylol.Locked = true
  22. Raylol.formFactor = "Custom"
  23. Raylol.BottomSurface = "Smooth"
  24. Raylol.TopSurface = "Smooth"
  25. Raylol.Name = "Ray"
  26. local Distance = (Position - game.Workspace.Raycaster.RayPart.Position).magnitude
  27. Raylol.Size = Vector3.new(0.2,0.2,Distance)
  28. Raylol.CFrame = CFrame.new(Position,game.Workspace.Raycaster.RayPart.Position) * CFrame.new(0,0,-Distance/2)
  29. game:GetService("Debris"):AddItem(Raylol,0.1)
  30. end end end
  31. wait()
  32. CastRay(true,"Bright yellow",0,false)
  33. wait(0.25)
  34. end end end end)