Advertisement
doryna2281337

Untitled

Aug 14th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.30 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  3. do
  4. print("FE Compatibility code by Mokiros")
  5. script.Parent = Player.Character
  6.  
  7. --RemoteEvent for communicating
  8. local Event = Instance.new("RemoteEvent")
  9. Event.Name = "UserInput_Event"
  10.  
  11. --Fake event to make stuff like Mouse.KeyDown work
  12. local function fakeEvent()
  13. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  14. t.connect = t.Connect
  15. return t
  16. end
  17.  
  18. --Creating fake input objects with fake variables
  19. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  20. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  21. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  22. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  23. end}
  24. --Merged 2 functions into one by checking amount of arguments
  25. CAS.UnbindAction = CAS.BindAction
  26.  
  27. --This function will trigger the events that have been :Connect()'ed
  28. local function te(self,ev,...)
  29. local t = m[ev]
  30. if t and t._fakeEvent and t.Function then
  31. t.Function(...)
  32. end
  33. end
  34. m.TrigEvent = te
  35. UIS.TrigEvent = te
  36.  
  37. Event.OnServerEvent:Connect(function(plr,io)
  38. if plr~=Player then return end
  39. if io.isMouse then
  40. m.Target = io.Target
  41. m.Hit = io.Hit
  42. else
  43. local b = io.UserInputState == Enum.UserInputState.Begin
  44. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  45. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  46. end
  47. for _,t in pairs(CAS.Actions) do
  48. for _,k in pairs(t.Keys) do
  49. if k==io.KeyCode then
  50. t.Function(t.Name,io.UserInputState,io)
  51. end
  52. end
  53. end
  54. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  55. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  56. end
  57. end)
  58. Event.Parent = NLS([==[
  59. local Player = game:GetService("Players").LocalPlayer
  60. local Event = script:WaitForChild("UserInput_Event")
  61.  
  62. local UIS = game:GetService("UserInputService")
  63. local input = function(io,a)
  64. if a then return end
  65. --Since InputObject is a client-side instance, we create and pass table instead
  66. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  67. end
  68. UIS.InputBegan:Connect(input)
  69. UIS.InputEnded:Connect(input)
  70.  
  71. local Mouse = Player:GetMouse()
  72. local h,t
  73. --Give the server mouse data 30 times every second, but only if the values changed
  74. --If player is not moving their mouse, client won't fire events
  75. while wait(1/30) do
  76. if h~=Mouse.Hit or t~=Mouse.Target then
  77. h,t=Mouse.Hit,Mouse.Target
  78. Event:FireServer({isMouse=true,Target=t,Hit=h})
  79. end
  80. end]==],Player.Character)
  81. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  82. end
  83. wait()
  84. script.Name = "_.:| E-Shield |:._"
  85. --script.Parent = _EShield_
  86. local LocalPlayer = owner
  87. local b, Platform = nil
  88. local PlayerOnly = false
  89. local Touched = {}
  90. local ShiftDown, CtrlDown, MouseDown, Mouse2Down, MouseDeb, Mouse2Tick = false, false, false, false, false, 0
  91.  
  92. function Create()
  93. if b then pcall(function() b:Destroy() end) end
  94. if Platform then pcall(function() Platform:Destroy() end) end
  95. local t = LocalPlayer.Character:FindFirstChild("Torso")
  96. local posit = Vector3.new(0, 50, 0)
  97. if t then posit = t.Position end
  98. Platform = Instance.new("Part")
  99. Platform.formFactor = "Custom"
  100. Platform.Size = Vector3.new(10, 1, 10)
  101. Platform.Transparency = 1
  102. Platform.Anchored = true
  103. Platform.CanCollide = true
  104. b = Instance.new("Part", game:service'Workspace')
  105. b.Position = posit
  106. b.Shape = "Ball"
  107. b.Transparency = 0
  108. b.Anchored = true
  109. b.Reflectance = 0.3
  110. b.Size = Mouse2Down and Vector3.new(25, 25, 25) or Vector3.new(15, 15, 15)
  111. b.Color = Mouse2Down and Color3.new(1, 0, 0) or Color3.new(0, 0, 1)
  112. b.TopSurface = "Smooth"
  113. b.BottomSurface = "Smooth"
  114. b.Locked = true
  115. b.CanCollide = false
  116. b.Changed:connect(function(w)
  117. if w == "Parent" then
  118. Create()
  119. end
  120. end)
  121. b.Touched:connect(function(obj)
  122. 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
  123. table.insert(Touched, obj)
  124. if PlayerOnly then
  125. if GetPlayer(obj) then
  126. Destroying(obj)
  127. end
  128. else
  129. Destroying(obj)
  130. end
  131. end
  132. end)
  133. end
  134.  
  135. function GetRecursiveChildren(Parent)
  136. local ret = {}
  137. for i, v in pairs(Parent:GetChildren()) do
  138. if #v:GetChildren() > 0 then
  139. local childs = GetRecursiveChildren(v)
  140. for i1, v1 in pairs(childs) do
  141. ret[#ret + 1] = v1
  142. end
  143. end
  144. ret[#ret + 1] = v
  145. end
  146. return ret
  147. end
  148.  
  149. function GetPlayer(Target)
  150. for _,v in pairs(game:service'Players':GetPlayers()) do
  151. if v.Character ~= nil and Target:IsDescendantOf(v.Character) then
  152. return v
  153. end
  154. end
  155. return nil
  156. end
  157.  
  158. function TouchedStatus(Target)
  159. for _,v in pairs(Touched) do
  160. if v == Target then
  161. return true
  162. end
  163. end
  164. return false
  165. end
  166.  
  167. function Destroying(obj)
  168. local ran, err = coroutine.resume(coroutine.create(function()
  169. if not Mouse2Down then
  170. obj:BreakJoints()
  171. obj.CanCollide = false
  172. obj.Anchored = false
  173. obj.formFactor = "Custom"
  174. obj.Size = obj.Size * Vector3.new(math.random(), math.random(), math.random())
  175. local bp = Instance.new("BodyPosition")
  176. bp.maxForce = Vector3.new(1/0,1/0,1/0)
  177. bp.Parent = obj
  178. local X, Y, Z = nil, nil, nil
  179. coroutine.wrap(function()
  180. while obj and obj.Parent do
  181. X, Y, Z = math.random(-5, 5), math.random(-5, 5), math.random(-5, 5)
  182. wait(0.3)
  183. end
  184. end)()
  185. coroutine.wrap(function()
  186. while obj and obj.Parent do
  187. bp.position = LocalPlayer.Character.Torso.Position + Vector3.new(X, Y, Z)
  188. wait()
  189. end
  190. end)()
  191. coroutine.wrap(function()
  192. local transp = 0
  193. for i = 1, 50 do
  194. transp = transp + 0.02
  195. obj.Transparency = transp
  196. wait(0.05)
  197. end
  198. game:service'Debris':AddItem(obj, 0)
  199. end)()
  200. elseif Mouse2Down then
  201. local selbox = Instance.new("SelectionBox", obj)
  202. selbox.Adornee = obj
  203. selbox.Color = BrickColor.new("Really red")
  204. selbox.Transparency = 0
  205. wait(2)
  206. coroutine.wrap(function()
  207. local transp = 0
  208. local Size, Position = obj.Size, obj.Position
  209. local brickTable = {}
  210. game:service'Debris':AddItem(obj, 0)
  211. for i = 1, math.random(2, 4) do
  212. local x, y, z = math.random(), math.random(), math.random()
  213. local Brick = Instance.new("Part")
  214. Brick.Name = "WillNotBeRemoved"
  215. Brick.Parent = game:service'Workspace'
  216. Brick.BrickColor = BrickColor.new("White")
  217. Brick.Size = Size * Vector3.new(x, y, z)
  218. Brick.CFrame = CFrame.new(Position) * CFrame.Angles( x * 180, y * 180, z * 180)
  219. Brick.Locked = true
  220. Brick.Anchored = false
  221. Brick.CanCollide = false
  222. local Selection = Instance.new("SelectionBox", Brick)
  223. Selection.Adornee = Brick
  224. Selection.Color = BrickColor.new("White")
  225. Selection.Transparency = 0
  226. local BodyVelo = Instance.new("BodyVelocity", Brick)
  227. BodyVelo.maxForce = Vector3.new(1/0, 1/0, 1/0)
  228. BodyVelo.velocity = Vector3.new(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10))
  229. brickTable[#brickTable + 1] = {Brick, Selection}
  230. end
  231. for i = 1, 50 do
  232. transp = transp + 0.02
  233. for i1, v in pairs(brickTable) do
  234. v[1].Transparency = transp
  235. v[2].Transparency = transp
  236. end
  237. wait(0.05)
  238. end
  239. --for i, v in pairs(brickTable) do game:service'Debris':AddItem(v[1], 0) game:service'Debris':AddItem(v[2], 0) end
  240. end)()
  241. end
  242. end))
  243. if not ran then print(".:| EShield |:. " .. err) end
  244. end
  245.  
  246. Create()
  247.  
  248. Mouse.Button1Down:connect(function()
  249. MouseDown = true
  250. end)
  251.  
  252. Mouse.Button1Up:connect(function()
  253. MouseDown = false
  254. end)
  255.  
  256. Mouse.KeyDown:connect(function(key)
  257. local key = type(key) == "string" and key:lower() or ""
  258. if key == "r" then
  259. print = function() end
  260. script:Destroy()
  261. for i, v in pairs(getfenv()) do pcall(function() v:Destroy() end) getfenv()[i] = nil end
  262. end
  263. end)
  264.  
  265. Mouse.Button2Down:connect(function()
  266. if not Mouse2Down then
  267. Mouse2Tick = tick()
  268. Mouse2Down = true
  269. coroutine.wrap(function()
  270. for i = 1.1, 0, -0.1 do if Mouse2Down then b.Color = Color3.new(0, 0, i) end wait(0.01) end
  271. for i = 0, 1.1, 0.1 do if Mouse2Down then b.Color = Color3.new(i, 0, 0) end wait(0.01) end
  272. end)()
  273. coroutine.wrap(function()
  274. 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
  275. end)()
  276. end
  277. end)
  278.  
  279. Mouse.Button2Up:connect(function()
  280. if Mouse2Down then
  281. if math.floor(tick() - Mouse2Tick) > 1 then
  282. Mouse2Down = false
  283. coroutine.wrap(function()
  284. for i = 1.1, 0, -0.1 do if not Mouse2Down then b.Color = Color3.new(i, 0, 0) end wait(0.01) end
  285. for i = 0, 1.1, 0.1 do if not Mouse2Down then b.Color = Color3.new(0, 0, i) end wait(0.01) end
  286. end)()
  287. coroutine.wrap(function()
  288. 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
  289. end)()
  290. end
  291. end
  292. end)
  293.  
  294. Mouse.KeyDown:connect(function(key)
  295. if key == "0" then
  296. ShiftDown = true
  297. elseif key == "1" or key == "2" then
  298. CtrlDown = true
  299. end
  300. end)
  301.  
  302. Mouse.KeyUp:connect(function(key)
  303. if key == "0" then
  304. ShiftDown = false
  305. elseif key == "1" or key == "2" then
  306. CtrlDown = false
  307. end
  308. end)
  309.  
  310. coroutine.wrap(function()
  311. while wait(0.05) do
  312. for i = 0.2, 0.8, 0.1 do
  313. b.Transparency = i
  314. wait(0.05)
  315. end
  316. for i = 0.7, 0.1, -0.1 do
  317. b.Transparency = i
  318. wait(0.05)
  319. end
  320. end
  321. end)()
  322.  
  323. game:service'RunService'.Stepped:connect(function()
  324. coroutine.resume(coroutine.create(function()
  325. b.CFrame = CFrame.new(LocalPlayer.Character.Torso.Position)
  326. end))
  327. coroutine.resume(coroutine.create(function()
  328. for i, v in pairs(Touched) do
  329. if v.Parent == nil or v == nil then
  330. table.remove(Touched, i)
  331. end
  332. end
  333. end))
  334. coroutine.resume(coroutine.create(function()
  335. local Height = LocalPlayer.Character.Torso.CFrame.y - 3.5
  336. if ShiftDown then
  337. Height = Height - 0.25
  338. if CtrlDown then
  339. Height = Height - 0.75
  340. end
  341. end
  342. local TargetCFrame = LocalPlayer.Character.Torso.CFrame
  343. local TargetAngle = LocalPlayer.Character.Torso.CFrame.lookVector
  344. Platform.Parent = game:service'Workspace'.CurrentCamera
  345. Platform.CFrame = CFrame.new(TargetCFrame.x, Height, TargetCFrame.z)
  346. Platform.CanCollide = true
  347. LocalPlayer.Character.Torso.CFrame = TargetCFrame * CFrame.new(0, -(TargetCFrame.y) + Height + 3.5, 0)
  348. end))
  349. coroutine.resume(coroutine.create(function()
  350. if LocalPlayer.Parent ~= nil then
  351. for i, v in pairs(GetRecursiveChildren(LocalPlayer.Character)) do
  352. if v.className == "Part" then v.CanCollide = false end
  353. end
  354. end
  355. end))
  356. coroutine.resume(coroutine.create(function()
  357. if MouseDown and not MouseDeb and not Mouse2Down then
  358. MouseDeb = true
  359. coroutine.wrap(function() wait(1) MouseDeb = false end)()
  360. local dist = Instance.new("Part")
  361. dist.CFrame = CFrame.new(LocalPlayer.Character.Torso.Position)
  362. dist.formFactor = "Custom"
  363. dist.Shape = "Ball"
  364. dist.Name = "WillNotBeRemoved"
  365. dist.Transparency = 0
  366. dist.Reflectance = 0.1
  367. dist.Size = Vector3.new(10, 10, 10)
  368. dist.BrickColor = BrickColor.new("New Yeller")
  369. dist.TopSurface = "Smooth"
  370. dist.Anchored = true
  371. dist.BottomSurface = "Smooth"
  372. dist.Locked = true
  373. dist.CanCollide = false
  374. dist.Parent = game:service'Workspace'
  375. dist.Touched:connect(function(obj)
  376. coroutine.resume(coroutine.create(function()
  377. local Player = GetPlayer(obj)
  378. if Player and Player ~= LocalPlayer and Player.Character and Player.Character:FindFirstChild("Torso") then
  379. local BV = Instance.new("BodyVelocity", Player.Character.Torso)
  380. BV.maxForce = Vector3.new(1/0, 1/0, 1/0)
  381. BV.velocity = ((LocalPlayer.Character.Torso.Position - Player.Character.Torso.Position).unit * -50)
  382. game:service'Debris':AddItem(BV, 1)
  383. elseif not Player and obj ~= b and obj.Name ~= "Base" and not obj:IsDescendantOf(game:service'Workspace'.CurrentCamera) then
  384. obj:BreakJoints()
  385. obj.Anchored = false
  386. obj.CanCollide = false
  387. local BV = Instance.new("BodyVelocity", obj)
  388. BV.maxForce = Vector3.new(1/0, 1/0, 1/0)
  389. BV.velocity = ((LocalPlayer.Character.Torso.Position - obj.Position).unit * -50)
  390. game:service'Debris':AddItem(BV, 1)
  391. end
  392. end))
  393. end)
  394. coroutine.wrap(function()
  395. for i = 1, 100 do
  396. dist.Transparency = dist.Transparency + 0.01
  397. dist.Size = dist.Size + Vector3.new(1, 1, 1)
  398. dist.CFrame = CFrame.new(LocalPlayer.Character.Torso.Position)
  399. wait()
  400. end
  401. game:service'Debris':AddItem(dist, 0)
  402. end)()
  403. end
  404. end))
  405. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement