Advertisement
DrakerMaker

Forcefield

May 27th, 2019
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2.  
  3. local avatar = player.Character
  4.  
  5. local forcefield = Instance.new("Hat")
  6.  
  7. forcefield.Parent = avatar
  8.  
  9. forcefield.AttachmentForward = Vector3.new(0, 0, -1)
  10. forcefield.AttachmentPos = Vector3.new(0, 1.95, -0.4)
  11. forcefield.AttachmentRight = Vector3.new(1, 0, 0)
  12. forcefield.AttachmentUp = Vector3.new(0, 1, 0)
  13.  
  14. local forcefieldball = Instance.new("Part")
  15.  
  16. forcefieldball.Parent = forcefield
  17. forcefieldball.Shape = 0
  18. forcefieldball.BrickColor = BrickColor.new("Cyan")
  19. forcefieldball.Material = "ForceField"
  20. forcefieldball.Size = Vector3.new(9, 9, 9)
  21. forcefieldball.CanCollide = false
  22.  
  23. local attachment = Instance.new("Attachment")
  24.  
  25. attachment.Parent = forcefieldball
  26.  
  27. attachment.Axis = Vector3.new(1, 0, 0)
  28.  
  29. attachment.SecondaryAxis = Vector3.new(0, 1, 0)
  30.  
  31. attachment.WorldAxis = Vector3.new(0.238, -0.018, 0.971)
  32.  
  33. attachment.WorldOrientation = Vector3.new(-0.198, -76.24, -1.046)
  34.  
  35. attachment.WorldPosition = Vector3.new(-47.707, 3.205, 70.034)
  36.  
  37. attachment.SecondaryAxis = Vector3.new(0.008, 1, 0.017)
  38.  
  39. local weld = Instance.new("Weld")
  40.  
  41. weld.Parent = forcefieldball
  42.  
  43. weld.Part0 = forcefieldball
  44.  
  45. weld.Part1 = avatar.Head
  46.  
  47. function onTouch(part)
  48. local humanoid = part.Parent:FindFirstChild("Humanoid")
  49. if not part.Name == "Baseplate" then
  50. part:Destroy()
  51. end
  52. if (humanoid ~= nil) then -- if a humanoid exists, then
  53. humanoid.Health = 0
  54. end
  55. end
  56. forcefieldball.Touched:connect(onTouch)
  57.  
  58.  
  59. while wait() do
  60. forcefieldball.Color = Color3.new(255/255,0/255,0/255)
  61. for i = 0,255,10 do
  62. wait()
  63. forcefieldball.Color = Color3.new(255/255,i/255,0/255)
  64. end
  65. for i = 255,0,-10 do
  66. wait()
  67. forcefieldball.Color = Color3.new(i/255,255/255,0/255)
  68. end
  69. for i = 0,255,10 do
  70. wait()
  71. forcefieldball.Color = Color3.new(0/255,255/255,i/255)
  72. end
  73. for i = 255,0,-10 do
  74. wait()
  75. forcefieldball.Color = Color3.new(0/255,i/255,255/255)
  76. end
  77. for i = 0,255,10 do
  78. wait()
  79. forcefieldball.Color = Color3.new(i/255,0/255,255/255)
  80. end
  81. for i = 255,0,-10 do
  82. wait()
  83. forcefieldball.Color = Color3.new(255/255,0/255,i/255)
  84. end
  85. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement