Advertisement
Rusty_Clock

Death cube [Roblox Script]

Jan 3rd, 2018
947
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. --This is needs to be in a local script
  2. local player = game:GetService('Players').LocalPlayer
  3. local char = player.Character
  4. local mouse = player:GetMouse()
  5.  
  6. --Beam source
  7. local b = Instance.new('Part')
  8. b.Parent = game.Workspace
  9. b.Size = Vector3.new(10,10,10)
  10. b.CanCollide = false
  11. b.Name = 'Cube'
  12. b.Color = Color3.new(BrickColor.White(255,255,255))
  13. b.Locked = true
  14. --thrust
  15. local rok = Instance.new('BodyPosition')
  16. rok.Parent = b
  17. rok.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  18. rok.P = 9999
  19. b.BodyPosition.Position = Vector3.new(char.Torso.Position.X,15,char.Torso.Position.Z)
  20.  
  21. b.Material = 'Neon'
  22.  
  23. mouse.Button1Down:connect(function (clickdown)
  24.  
  25.  
  26.  
  27. local ray = Ray.new(b.CFrame.p, (mouse.Hit.p - b.CFrame.p).unit * 300)
  28. local part, position = workspace:FindPartOnRay(ray, player.Character, false, true)
  29.  
  30. local beam = Instance.new("Part", workspace)
  31. beam.BrickColor = BrickColor.new("Really black")
  32. beam.FormFactor = "Custom"
  33. beam.Material = "Neon"
  34. beam.Transparency = 0
  35. beam.Anchored = true
  36. beam.Locked = true
  37. beam.CanCollide = false
  38. beam.Name = 'b09'
  39. local distance = (b.CFrame.p - position).magnitude
  40. beam.Size = Vector3.new(3, 3, distance)
  41. mouse.Target.Anchored = true
  42. if mouse.Target.Name ~= 'Base' then
  43. print(mouse.Target.Name)
  44. mouse.Target:Destroy()
  45. end
  46.  
  47.  
  48.  
  49. while true do
  50.  
  51. local ray = Ray.new(b.CFrame.p, (
  52.  
  53. mouse.Hit.p - b.CFrame.p).unit * 300)
  54. local distance = (b.CFrame.p - position).magnitude
  55. beam.Size = Vector3.new(3, 3, distance)
  56. beam.CFrame = CFrame.new(b.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
  57. wait()
  58.  
  59. end
  60.  
  61.  
  62.  
  63. end)
  64. mouse.Button1Up:connect(function (clickup)
  65. game.Workspace.b09:Destroy()
  66.  
  67. end)
  68.  
  69. while true do
  70.  
  71. b.BodyPosition.Position = Vector3.new(char.Torso.Position.X,15,char.Torso.Position.Z)
  72.  
  73.  
  74. wait(.1)
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement