Advertisement
dahpiglz

Untitled

Nov 17th, 2018
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.38 KB | None | 0 0
  1. function ApplyForceField(character, forcefield, duration)
  2. local attachto = character:FindFirstChild("HumanoidRootPart")
  3.  
  4. if attachto then
  5. if forcefield ~= nil then
  6. print("MakeFF")
  7. forcefield.Visible = false
  8.  
  9. local MainFFPart = Instance.new("Part")
  10. MainFFPart.Parent = character
  11. MainFFPart.Size = Vector3.new(7,7,7)
  12. MainFFPart.Color = Color3.fromRGB(0, 16, 176)
  13. MainFFPart.Shape = "Ball"
  14. MainFFPart.TopSurface = "Smooth"
  15. MainFFPart.BottomSurface = "Smooth"
  16. MainFFPart.Transparency = 0.8
  17. MainFFPart.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0)
  18. MainFFPart.CanCollide = false
  19. MainFFPart.Position = attachto.Position
  20.  
  21. game:GetService("Debris"):AddItem(MainFFPart, duration)
  22.  
  23. local SecondaryFFPart = Instance.new("Part")
  24. SecondaryFFPart.Parent = MainFFPart
  25. SecondaryFFPart.Size = Vector3.new(7.5,7.5,7.5)
  26. SecondaryFFPart.Color = Color3.fromRGB(0, 16, 176)
  27. SecondaryFFPart.Shape = "Ball"
  28. SecondaryFFPart.TopSurface = "Smooth"
  29. SecondaryFFPart.BottomSurface = "Smooth"
  30. SecondaryFFPart.Transparency = 1
  31. SecondaryFFPart.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0)
  32. SecondaryFFPart.CanCollide = false
  33. SecondaryFFPart.Position = attachto.Position
  34.  
  35. local MainFFWeld = Instance.new("Weld")
  36. MainFFWeld.Parent = MainFFPart
  37. MainFFWeld.Part0 = MainFFPart
  38. MainFFWeld.Part1 = attachto
  39.  
  40. local SecondaryFFWeld = Instance.new("Weld")
  41. SecondaryFFWeld.Parent = SecondaryFFPart
  42. SecondaryFFWeld.Part0 = SecondaryFFPart
  43. SecondaryFFWeld.Part1 = MainFFPart
  44.  
  45. while true do
  46. for i = 1,10 do
  47. wait(0.05)
  48. MainFFPart.Transparency = MainFFPart.Transparency + 0.05
  49. SecondaryFFPart.Transparency = SecondaryFFPart.Transparency - 0.05
  50. end
  51. for i = 1,10 do
  52. wait(0.05)
  53. MainFFPart.Transparency = MainFFPart.Transparency - 0.05
  54. SecondaryFFPart.Transparency = SecondaryFFPart.Transparency + 0.05
  55. end
  56. end
  57. end
  58. end
  59. end
  60.  
  61. function PlayerAdded(player)
  62. local function CharacterAdded(character)
  63. local ff = Instance.new("ForceField")
  64. ff.Parent = character
  65. game:GetService("Debris"):AddItem(ff, 10)
  66.  
  67. ApplyForceField(character, ff, 10)
  68. end
  69.  
  70. player.CharacterAdded:Connect(CharacterAdded)
  71. end
  72.  
  73. for i,v in pairs(game.Players:GetChildren()) do
  74. PlayerAdded(v)
  75. end
  76.  
  77. game.Players.PlayerAdded:Connect(PlayerAdded)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement