naser2345

Uber shield

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