Advertisement
mathmasterphil

Protector

Mar 8th, 2015
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.64 KB | None | 0 0
  1. lpc=game.Players.LocalPlayer.Character
  2. m=Instance.new("Model",lpc)
  3. m.Name=lpc.Name.."'s Protector"
  4. p=Instance.new("Part",m)
  5. p.Name="Head"
  6. p.Size=Vector3.new(2,2,2)
  7. b=Instance.new("BodyPosition",p)
  8. b.maxForce = Vector3.new()*math.huge
  9. p.Shape="Ball"
  10. p.TopSurface,p.BottomSurface="Smooth","Smooth"
  11. p.BrickColor=BrickColor.new("Bright red")
  12. p.Transparency=0.5
  13. h=Instance.new("Humanoid",m)
  14. h.Health,h.MaxHealth=0,0
  15. p.Touched:connect(function(h)
  16. if h.Parent:findFirstChild("Humanoid") then
  17. if h.Parent.Name~=game.Players.LocalPlayer.Name then
  18. s=Instance.new("StringValue",h.Parent.Humanoid)
  19. s.Name="creator"
  20. s.Value=lpc.Name
  21. h:BreakJoints()
  22. end
  23. end
  24. end)
  25.  
  26. track = false
  27. function trail(obj,s,t,lt,color,fade)
  28. coroutine.resume(coroutine.create(function()
  29. while track do
  30. old = obj.Position
  31. wait()
  32. new = obj.Position
  33.  
  34. -- mag = (old-new).magnitude
  35. dist = (old+new)/2
  36.  
  37. local ray = Instance.new("Part",lpc)
  38. ray.TopSurface,ray.BottomSurface = 0,0
  39. ray.Anchored = true
  40. ray.formFactor = "Custom"
  41. ray.CanCollide = false
  42. ray.Color = obj.Color
  43. ray.Transparency = .5
  44. ray.Size = Vector3.new(2,2,2)
  45. ray.Shape = "Ball"
  46.  
  47. ray.CFrame = CFrame.new(dist,old)*CFrame.Angles(math.pi/2,0,0)
  48. if fade ~= nil then
  49. delay(lt,function()
  50. for i = t,1,fade do wait() ray.Transparency = i end ray:Remove() end)
  51. else
  52. game:GetService("Debris"):AddItem(ray,lt)
  53. end
  54.  
  55. if color ~= nil then ray.BrickColor = BrickColor.new(color) end
  56.  
  57. end
  58. end)) end
  59.  
  60. track = true trail(p,.5,.5,1)
  61.  
  62. coroutine.resume(coroutine.create(function()
  63. while wait() do
  64. r = 10
  65. for i = 1,360,5 do
  66. wait()
  67. b.position=lpc.Torso.Position + Vector3.new(math.cos(math.rad(i))*r,math.sin(i*50),math.sin(math.rad(i))*r)
  68. end
  69.  
  70. end
  71. end))
  72.  
  73. function Cht(m,s)
  74. pcall(function()
  75. if m=="on/" then
  76. p.Touched:connect(function(h)
  77. if h.Parent:findFirstChild("Humanoid") then
  78. if h.Parent.Name~=game.Players.LocalPlayer.Name then
  79. s=Instance.new("StringValue",h.Parent.Humanoid)
  80. s.Name="creator"
  81. s.Value=lpc.Name
  82. h:BreakJoints()
  83. end
  84. end
  85. end)
  86. end
  87. if m=="off/" then
  88. p.Touched:connect(function() end)
  89. end
  90. if m=="protect/" then
  91. lpc.Humanoid.MaxHealth=1/0
  92. p.BrickColor=BrickColor.new("Navy blue")
  93. Instance.new("ForceField",lpc)
  94. end
  95. if m=="kill/" then
  96. p.BrickColor=BrickColor.new("New Yeller")
  97. lpc:BreakJoints()
  98. end
  99. if m=="reset/" then
  100. m=Instance.new("Model",Workspace)
  101. m.Name=lpc.Name
  102. x=Instance.new("Humanoid",m)
  103. h=Instance.new("Part",m)
  104. h.Name="Head"
  105. t=Instance.new("Part",m)
  106. t.Name="Torso"
  107. t.Anchored=true
  108. h.Anchored=true
  109. t.Transparency=1
  110. h.Transparency=1
  111. game.Players.LocalPlayer.Character=m
  112. lpc:remove()
  113. end
  114. end)
  115. end
  116. game.Players.LocalPlayer.Chatted:connect(function(m) Cht(m,lpc.Parent) end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement