derekiscool423

shield

Mar 26th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.00 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------MADE BY CALEB0702-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  2. wait()
  3. script.Name = "_.:| E-Shield |:._"
  4. --script.Parent = _EShield_
  5. local LocalPlayer = game:service'Players'.LocalPlayer
  6. local b, Platform = nil
  7. local PlayerOnly = false
  8. local Touched = {}
  9. local Mouse = LocalPlayer:GetMouse()
  10. local ShiftDown, CtrlDown, MouseDown, Mouse2Down, MouseDeb, Mouse2Tick = false, false, false, false, false, 0
  11.  
  12. function Create()
  13. if b then pcall(function() b:Destroy() end) end
  14. if Platform then pcall(function() Platform:Destroy() end) end
  15. local t = LocalPlayer.Character:FindFirstChild("Torso")
  16. local posit = Vector3.new(0, 50, 0)
  17. if t then posit = t.Position end
  18. Platform = Instance.new("Part")
  19. Platform.formFactor = "Custom"
  20. Platform.Size = Vector3.new(10, 1, 10)
  21. Platform.Transparency = 1
  22. Platform.Anchored = true
  23. Platform.CanCollide = true
  24. b = Instance.new("Part", game:service'Workspace')
  25. b.Position = posit
  26. b.Shape = "Ball"
  27. b.Transparency = 0
  28. b.Anchored = true
  29. b.Reflectance = 0.3
  30. b.Size = Mouse2Down and Vector3.new(25, 25, 25) or Vector3.new(15, 15, 15)
  31. b.Color = Mouse2Down and Color3.new(1, 0, 0) or Color3.new(0, 0, 1)
  32. b.TopSurface = "Smooth"
  33. b.BottomSurface = "Smooth"
  34. b.Locked = true
  35. b.CanCollide = false
  36. b.Changed:connect(function(w)
  37. if w == "Parent" then
  38. Create()
  39. end
  40. end)
  41. b.Touched:connect(function(obj)
  42. if obj.Name ~= "WillNotBeRemoved" and not TouchedStatus(obj) and not obj:IsDescendantOf(LocalPlayer.Character) and not obj:IsDescendantOf(game:service'Workspace'.CurrentCamera) and obj.Name ~= "Base" and obj.className == "Part" then
  43. table.insert(Touched, obj)
  44. if PlayerOnly then
  45. if GetPlayer(obj) then
  46. Destroying(obj)
  47. end
  48. else
  49. Destroying(obj)
  50. end
  51. end
  52. end)
  53. end
  54.  
  55. function GetRecursiveChildren(Parent)
  56. local ret = {}
  57. for i, v in pairs(Parent:GetChildren()) do
  58. if #v:GetChildren() > 0 then
  59. local childs = GetRecursiveChildren(v)
  60. for i1, v1 in pairs(childs) do
  61. ret[#ret + 1] = v1
  62. end
  63. end
  64. ret[#ret + 1] = v
  65. end
  66. return ret
  67. end
  68.  
  69. function GetPlayer(Target)
  70. for _,v in pairs(game:service'Players':GetPlayers()) do
  71. if v.Character ~= nil and Target:IsDescendantOf(v.Character) then
  72. return v
  73. end
  74. end
  75. return nil
  76. end
  77.  
  78. function TouchedStatus(Target)
  79. for _,v in pairs(Touched) do
  80. if v == Target then
  81. return true
  82. end
  83. end
  84. return false
  85. end
  86.  
  87. function Destroying(obj)
  88. local ran, err = coroutine.resume(coroutine.create(function()
  89. if not Mouse2Down then
  90. obj:BreakJoints()
  91. obj.CanCollide = false
  92. obj.Anchored = false
  93. obj.formFactor = "Custom"
  94. obj.Size = obj.Size * Vector3.new(math.random(), math.random(), math.random())
  95. local bp = Instance.new("BodyPosition")
  96. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  97. bp.Parent = obj
  98. local X, Y, Z = nil, nil, nil
  99. coroutine.wrap(function()
  100. while obj and obj.Parent do
  101. X, Y, Z = math.random(-5, 5), math.random(-5, 5), math.random(-5, 5)
  102. wait(0.3)
  103. end
  104. end)()
  105. coroutine.wrap(function()
  106. while obj and obj.Parent do
  107. bp.position = LocalPlayer.Character.Torso.Position + Vector3.new(X, Y, Z)
  108. wait()
  109. end
  110. end)()
  111. coroutine.wrap(function()
  112. local transp = 0
  113. for i = 1, 50 do
  114. transp = transp + 0.02
  115. obj.Transparency = transp
  116. wait(0.05)
  117. end
  118. game:service'Debris':AddItem(obj, 0)
  119. end)()
  120. elseif Mouse2Down then
  121. local selbox = Instance.new("SelectionBox", obj)
  122. selbox.Adornee = obj
  123. selbox.Color = BrickColor.new("Really red")
  124. selbox.Transparency = 0
  125. wait(2)
  126. coroutine.wrap(function()
  127. local transp = 0
  128. local Size, Position = obj.Size, obj.Position
  129. local brickTable = {}
  130. game:service'Debris':AddItem(obj, 0)
  131. for i = 1, math.random(2, 4) do
  132. local x, y, z = math.random(), math.random(), math.random()
  133. local Brick = Instance.new("Part")
  134. Brick.Name = "WillNotBeRemoved"
  135. Brick.Parent = game:service'Workspace'
  136. Brick.BrickColor = BrickColor.new("White")
  137. Brick.Size = Size * Vector3.new(x, y, z)
  138. Brick.CFrame = CFrame.new(Position) * CFrame.Angles( x * 180, y * 180, z * 180)
  139. Brick.Locked = true
  140. Brick.Anchored = false
  141. Brick.CanCollide = false
  142. local Selection = Instance.new("SelectionBox", Brick)
  143. Selection.Adornee = Brick
  144. Selection.Color = BrickColor.new("White")
  145. Selection.Transparency = 0
  146. local BodyVelo = Instance.new("BodyVelocity", Brick)
  147. BodyVelo.maxForce = Vector3.new(1/0, 1/0, 1/0)
  148. BodyVelo.velocity = Vector3.new(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10))
  149. brickTable[#brickTable + 1] = {Brick, Selection}
  150. end
  151. for i = 1, 50 do
  152. transp = transp + 0.02
  153. for i1, v in pairs(brickTable) do
  154. v[1].Transparency = transp
  155. v[2].Transparency = transp
  156. end
  157. wait(0.05)
  158. end
  159. --for i, v in pairs(brickTable) do game:service'Debris':AddItem(v[1], 0) game:service'Debris':AddItem(v[2], 0) end
  160. end)()
  161. end
  162. end))
  163. if not ran then print(".:| EShield |:. " .. err) end
  164. end
  165.  
  166. Create()
  167.  
  168. Mouse.Button1Down:connect(function()
  169. MouseDown = true
  170. end)
  171.  
  172. Mouse.Button1Up:connect(function()
  173. MouseDown = false
  174. end)
  175.  
  176. Mouse.KeyDown:connect(function(key)
  177. local key = type(key) == "string" and key:lower() or ""
  178. if key == "r" then
  179. print = function() end
  180. script:Destroy()
  181. for i, v in pairs(getfenv()) do pcall(function() v:Destroy() end) getfenv()[i] = nil end
  182. end
  183. end)
  184.  
  185. Mouse.Button2Down:connect(function()
  186. if not Mouse2Down then
  187. Mouse2Tick = tick()
  188. Mouse2Down = true
  189. coroutine.wrap(function()
  190. for i = 1.1, 0, -0.1 do if Mouse2Down then b.Color = Color3.new(0, 0, i) end wait(0.01) end
  191. for i = 0, 1.1, 0.1 do if Mouse2Down then b.Color = Color3.new(i, 0, 0) end wait(0.01) end
  192. end)()
  193. coroutine.wrap(function()
  194. for i = 15, 25 do if Mouse2Down then b.Size = Vector3.new(i, i, i) b.CFrame = CFrame.new(LocalPlayer.Character.Torso.Position) end wait(0.05) end
  195. end)()
  196. end
  197. end)
  198.  
  199. Mouse.Button2Up:connect(function()
  200. if Mouse2Down then
  201. if math.floor(tick() - Mouse2Tick) > 1 then
  202. Mouse2Down = false
  203. coroutine.wrap(function()
  204. for i = 1.1, 0, -0.1 do if not Mouse2Down then b.Color = Color3.new(i, 0, 0) end wait(0.01) end
  205. for i = 0, 1.1, 0.1 do if not Mouse2Down then b.Color = Color3.new(0, 0, i) end wait(0.01) end
  206. end)()
  207. coroutine.wrap(function()
  208. for i = 25, 15, -1 do if not Mouse2Down then b.Size = Vector3.new(i, i, i) b.CFrame = CFrame.new(LocalPlayer.Character.Torso.Position) end wait(0.05) end
  209. end)()
  210. end
  211. end
  212. end)
  213.  
  214. Mouse.KeyDown:connect(function(key)
  215. if key == "0" then
  216. ShiftDown = true
  217. elseif key == "1" or key == "2" then
  218. CtrlDown = true
  219. end
  220. end)
  221.  
  222. Mouse.KeyUp:connect(function(key)
  223. if key == "0" then
  224. ShiftDown = false
  225. elseif key == "1" or key == "2" then
  226. CtrlDown = false
  227. end
  228. end)
  229.  
  230. coroutine.wrap(function()
  231. while wait(0.05) do
  232. for i = 0.2, 0.8, 0.1 do
  233. b.Transparency = i
  234. wait(0.05)
  235. end
  236. for i = 0.7, 0.1, -0.1 do
  237. b.Transparency = i
  238. wait(0.05)
  239. end
  240. end
  241. end)()
  242.  
  243. game:service'RunService'.Stepped:connect(function()
  244. coroutine.resume(coroutine.create(function()
  245. b.CFrame = CFrame.new(LocalPlayer.Character.Torso.Position)
  246. end))
  247. coroutine.resume(coroutine.create(function()
  248. for i, v in pairs(Touched) do
  249. if v.Parent == nil or v == nil then
  250. table.remove(Touched, i)
  251. end
  252. end
  253. end))
  254. coroutine.resume(coroutine.create(function()
  255. local Height = LocalPlayer.Character.Torso.CFrame.y - 3.5
  256. if ShiftDown then
  257. Height = Height - 0.25
  258. if CtrlDown then
  259. Height = Height - 0.75
  260. end
  261. end
  262. local TargetCFrame = LocalPlayer.Character.Torso.CFrame
  263. local TargetAngle = LocalPlayer.Character.Torso.CFrame.lookVector
  264. Platform.Parent = game:service'Workspace'.CurrentCamera
  265. Platform.CFrame = CFrame.new(TargetCFrame.x, Height, TargetCFrame.z)
  266. Platform.CanCollide = true
  267. LocalPlayer.Character.Torso.CFrame = TargetCFrame * CFrame.new(0, -(TargetCFrame.y) + Height + 3.5, 0)
  268. end))
  269. coroutine.resume(coroutine.create(function()
  270. if LocalPlayer.Parent ~= nil then
  271. for i, v in pairs(GetRecursiveChildren(LocalPlayer.Character)) do
  272. if v.className == "Part" then v.CanCollide = false end
  273. end
  274. end
  275. end))
  276. coroutine.resume(coroutine.create(function()
  277. if MouseDown and not MouseDeb and not Mouse2Down then
  278. MouseDeb = true
  279. coroutine.wrap(function() wait(1) MouseDeb = false end)()
  280. local dist = Instance.new("Part")
  281. dist.CFrame = CFrame.new(LocalPlayer.Character.Torso.Position)
  282. dist.formFactor = "Custom"
  283. dist.Shape = "Ball"
  284. dist.Name = "WillNotBeRemoved"
  285. dist.Transparency = 0
  286. dist.Reflectance = 0.1
  287. dist.Size = Vector3.new(10, 10, 10)
  288. dist.BrickColor = BrickColor.new("New Yeller")
  289. dist.TopSurface = "Smooth"
  290. dist.Anchored = true
  291. dist.BottomSurface = "Smooth"
  292. dist.Locked = true
  293. dist.CanCollide = false
  294. dist.Parent = game:service'Workspace'
  295. dist.Touched:connect(function(obj)
  296. coroutine.resume(coroutine.create(function()
  297. local Player = GetPlayer(obj)
  298. if Player and Player ~= LocalPlayer and Player.Character and Player.Character:FindFirstChild("Torso") then
  299. local BV = Instance.new("BodyVelocity", Player.Character.Torso)
  300. BV.maxForce = Vector3.new(1/0, 1/0, 1/0)
  301. BV.velocity = ((LocalPlayer.Character.Torso.Position - Player.Character.Torso.Position).unit * -50)
  302. game:service'Debris':AddItem(BV, 1)
  303. elseif not Player and obj ~= b and obj.Name ~= "Base" and not obj:IsDescendantOf(game:service'Workspace'.CurrentCamera) then
  304. obj:BreakJoints()
  305. obj.Anchored = false
  306. obj.CanCollide = false
  307. local BV = Instance.new("BodyVelocity", obj)
  308. BV.maxForce = Vector3.new(1/0, 1/0, 1/0)
  309. BV.velocity = ((LocalPlayer.Character.Torso.Position - obj.Position).unit * -50)
  310. game:service'Debris':AddItem(BV, 1)
  311. end
  312. end))
  313. end)
  314. coroutine.wrap(function()
  315. for i = 1, 100 do
  316. dist.Transparency = dist.Transparency + 0.01
  317. dist.Size = dist.Size + Vector3.new(1, 1, 1)
  318. dist.CFrame = CFrame.new(LocalPlayer.Character.Torso.Position)
  319. wait()
  320. end
  321. game:service'Debris':AddItem(dist, 0)
  322. end)()
  323. end
  324. end))
  325. end)
Add Comment
Please, Sign In to add comment