SHOW:
|
|
- or go back to the newest paste.
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 | ||
84 | ||
85 | ||
86 | ||
87 | ||
88 | wait() | |
89 | script.Name = "_.:| E-Shield |:._" | |
90 | --script.Parent = _EShield_ | |
91 | - | local pla = game:service'Players'.Originickname |
91 | + | local pla = game:service'Players'.lafur2 |
92 | local b, Platform = nil | |
93 | local PlayerOnly = false | |
94 | local Touched = {} | |
95 | local ShiftDown, CtrlDown, MouseDown, Mouse1Down, MouseDeb, Mouse1tick = false, false, false, false, false, 0 | |
96 | ||
97 | function Create() | |
98 | if b then pcall(function() b:Destroy() end) end | |
99 | if Platform then pcall(function() Platform:Destroy() end) end | |
100 | local t = pla.Character:FindFirstChild("Torso") | |
101 | local posit = Vector3.new(0, 50, 0) | |
102 | if t then posit = t.Position end | |
103 | Platform = Instance.new("Part") | |
104 | Platform.formFactor = "Custom" | |
105 | Platform.Size = Vector3.new(10, 1, 10) | |
106 | Platform.Transparency = 1 | |
107 | Platform.Anchored = true | |
108 | Platform.CanCollide = true | |
109 | b = Instance.new("Part", game:service'Workspace') | |
110 | b.Position = posit | |
111 | b.Shape = "Ball" | |
112 | b.Transparency = 0 | |
113 | b.Anchored = true | |
114 | b.Reflectance = 0.3 | |
115 | b.Size = Mouse1Down and Vector3.new(25, 25, 25) or Vector3.new(15, 15, 15) | |
116 | b.Color = Mouse1Down and Color3.new(1, 0, 0) or Color3.new(0, 0, 1) | |
117 | b.TopSurface = "Smooth" | |
118 | b.BottomSurface = "Smooth" | |
119 | b.Locked = true | |
120 | b.CanCollide = false | |
121 | b.Changed:connect(function(w) | |
122 | if w == "Parent" then | |
123 | Create() | |
124 | end | |
125 | end) | |
126 | b.Touched:connect(function(obj) | |
127 | if obj.Name ~= "WillNotBeRemoved" and not TouchedStatus(obj) and not obj:IsDescendantOf(pla.Character) and not obj:IsDescendantOf(game:service'Workspace'.CurrentCamera) and obj.Name ~= "Base" and obj.className == "Part" then | |
128 | table.insert(Touched, obj) | |
129 | if PlayerOnly then | |
130 | if GetPlayer(obj) then | |
131 | Destroying(obj) | |
132 | end | |
133 | else | |
134 | Destroying(obj) | |
135 | end | |
136 | end | |
137 | end) | |
138 | end | |
139 | ||
140 | function GetRecursiveChildren(Parent) | |
141 | local ret = {} | |
142 | for i, v in pairs(Parent:GetChildren()) do | |
143 | if #v:GetChildren() > 0 then | |
144 | local childs = GetRecursiveChildren(v) | |
145 | for i1, v1 in pairs(childs) do | |
146 | ret[#ret + 1] = v1 | |
147 | end | |
148 | end | |
149 | ret[#ret + 1] = v | |
150 | end | |
151 | return ret | |
152 | end | |
153 | ||
154 | function GetPlayer(Target) | |
155 | for _,v in pairs(game:service'Players':GetPlayers()) do | |
156 | if v.Character ~= nil and Target:IsDescendantOf(v.Character) then | |
157 | return v | |
158 | end | |
159 | end | |
160 | return nil | |
161 | end | |
162 | ||
163 | function TouchedStatus(Target) | |
164 | for _,v in pairs(Touched) do | |
165 | if v == Target then | |
166 | return true | |
167 | end | |
168 | end | |
169 | return false | |
170 | end | |
171 | ||
172 | function Destroying(obj) | |
173 | local ran, err = coroutine.resume(coroutine.create(function() | |
174 | if not Mouse1Down then | |
175 | obj:BreakJoints() | |
176 | obj.CanCollide = false | |
177 | obj.Anchored = false | |
178 | obj.formFactor = "Custom" | |
179 | obj.Size = obj.Size * Vector3.new(math.random(), math.random(), math.random()) | |
180 | local bp = Instance.new("BodyPosition") | |
181 | bp.maxForce = Vector3.new(1/0,1/0,1/0) | |
182 | bp.Parent = obj | |
183 | local X, Y, Z = nil, nil, nil | |
184 | coroutine.wrap(function() | |
185 | while obj and obj.Parent do | |
186 | X, Y, Z = math.random(-5, 5), math.random(-5, 5), math.random(-5, 5) | |
187 | wait(0.3) | |
188 | end | |
189 | end)() | |
190 | coroutine.wrap(function() | |
191 | while obj and obj.Parent do | |
192 | bp.position = pla.Character.Torso.Position + Vector3.new(X, Y, Z) | |
193 | wait() | |
194 | end | |
195 | end)() | |
196 | coroutine.wrap(function() | |
197 | local transp = 0 | |
198 | for i = 1, 50 do | |
199 | transp = transp + 0.02 | |
200 | obj.Transparency = transp | |
201 | wait(0.05) | |
202 | end | |
203 | game:service'Debris':AddItem(obj, 0) | |
204 | end)() | |
205 | elseif Mouse1Down then | |
206 | local selbox = Instance.new("SelectionBox", obj) | |
207 | selbox.Adornee = obj | |
208 | selbox.Color = BrickColor.new("Really red") | |
209 | selbox.Transparency = 0 | |
210 | wait(2) | |
211 | coroutine.wrap(function() | |
212 | local transp = 0 | |
213 | local Size, Position = obj.Size, obj.Position | |
214 | local brickTable = {} | |
215 | game:service'Debris':AddItem(obj, 0) | |
216 | for i = 1, math.random(2, 4) do | |
217 | local x, y, z = math.random(), math.random(), math.random() | |
218 | local Brick = Instance.new("Part") | |
219 | Brick.Name = "WillNotBeRemoved" | |
220 | Brick.Parent = game:service'Workspace' | |
221 | Brick.BrickColor = BrickColor.new("White") | |
222 | Brick.Size = Size * Vector3.new(x, y, z) | |
223 | Brick.CFrame = CFrame.new(Position) * CFrame.Angles( x * 180, y * 180, z * 180) | |
224 | Brick.Locked = true | |
225 | Brick.Anchored = false | |
226 | Brick.CanCollide = false | |
227 | local Selection = Instance.new("SelectionBox", Brick) | |
228 | Selection.Adornee = Brick | |
229 | Selection.Color = BrickColor.new("White") | |
230 | Selection.Transparency = 0 | |
231 | local BodyVelo = Instance.new("BodyVelocity", Brick) | |
232 | BodyVelo.maxForce = Vector3.new(1/0, 1/0, 1/0) | |
233 | BodyVelo.velocity = Vector3.new(math.random(-10, 10), math.random(-10, 10), math.random(-10, 10)) | |
234 | brickTable[#brickTable + 1] = {Brick, Selection} | |
235 | end | |
236 | for i = 1, 50 do | |
237 | transp = transp + 0.02 | |
238 | for i1, v in pairs(brickTable) do | |
239 | v[1].Transparency = transp | |
240 | v[2].Transparency = transp | |
241 | end | |
242 | wait(0.05) | |
243 | end | |
244 | --for i, v in pairs(brickTable) do game:service'Debris':AddItem(v[1], 0) game:service'Debris':AddItem(v[2], 0) end | |
245 | end)() | |
246 | end | |
247 | end)) | |
248 | if not ran then print(".:| EShield |:. " .. err) end | |
249 | end | |
250 | ||
251 | Create() | |
252 | ||
253 | Mouse.Button1Down:connect(function() | |
254 | MouseDown = true | |
255 | end) | |
256 | ||
257 | Mouse.Button1Up:connect(function() | |
258 | MouseDown = false | |
259 | end) | |
260 | ||
261 | Mouse.KeyDown:connect(function(key) | |
262 | local key = type(key) == "string" and key:lower() or "" | |
263 | if key == "r" then | |
264 | print = function() end | |
265 | script:Destroy() | |
266 | for i, v in pairs(getfenv()) do pcall(function() v:Destroy() end) getfenv()[i] = nil end | |
267 | end | |
268 | end) | |
269 | ||
270 | Mouse.Button2Down:connect(function() | |
271 | if not Mouse1Down then | |
272 | Mouse1Tick = tick() | |
273 | Mouse1Down = true | |
274 | coroutine.wrap(function() | |
275 | for i = 1.1, 0, -0.1 do if Mouse1Down then b.Color = Color3.new(0, 0, i) end wait(0.01) end | |
276 | for i = 0, 1.1, 0.1 do if Mouse1Down then b.Color = Color3.new(i, 0, 0) end wait(0.01) end | |
277 | end)() | |
278 | coroutine.wrap(function() | |
279 | for i = 15, 25 do if Mouse1Down then b.Size = Vector3.new(i, i, i) b.CFrame = CFrame.new(pla.Character.Torso.Position) end wait(0.05) end | |
280 | end)() | |
281 | end | |
282 | end) | |
283 | ||
284 | Mouse.Button2Up:connect(function() | |
285 | if Mouse1Down then | |
286 | if math.floor(tick() - Mouse1Tick) > 1 then | |
287 | Mouse1Down = false | |
288 | coroutine.wrap(function() | |
289 | for i = 1.1, 0, -0.1 do if not Mouse1Down then b.Color = Color3.new(i, 0, 0) end wait(0.01) end | |
290 | for i = 0, 1.1, 0.1 do if not Mouse1Down then b.Color = Color3.new(0, 0, i) end wait(0.01) end | |
291 | end)() | |
292 | coroutine.wrap(function() | |
293 | for i = 25, 15, -1 do if not Mouse1Down then b.Size = Vector3.new(i, i, i) b.CFrame = CFrame.new(pla.Character.Torso.Position) end wait(0.05) end | |
294 | end)() | |
295 | end | |
296 | end | |
297 | end) | |
298 | ||
299 | Mouse.KeyDown:connect(function(key) | |
300 | if key == "0" then | |
301 | ShiftDown = true | |
302 | elseif key == "1" or key == "2" then | |
303 | CtrlDown = true | |
304 | end | |
305 | end) | |
306 | ||
307 | Mouse.KeyUp:connect(function(key) | |
308 | if key == "0" then | |
309 | ShiftDown = false | |
310 | elseif key == "1" or key == "2" then | |
311 | CtrlDown = false | |
312 | end | |
313 | end) | |
314 | ||
315 | coroutine.wrap(function() | |
316 | while wait(0.05) do | |
317 | for i = 0.2, 0.8, 0.1 do | |
318 | b.Transparency = i | |
319 | wait(0.05) | |
320 | end | |
321 | for i = 0.7, 0.1, -0.1 do | |
322 | b.Transparency = i | |
323 | wait(0.05) | |
324 | end | |
325 | end | |
326 | end)() | |
327 | ||
328 | game:service'RunService'.Stepped:connect(function() | |
329 | coroutine.resume(coroutine.create(function() | |
330 | b.CFrame = CFrame.new(pla.Character.Torso.Position) | |
331 | end)) | |
332 | coroutine.resume(coroutine.create(function() | |
333 | for i, v in pairs(Touched) do | |
334 | if v.Parent == nil or v == nil then | |
335 | table.remove(Touched, i) | |
336 | end | |
337 | end | |
338 | end)) | |
339 | coroutine.resume(coroutine.create(function() | |
340 | local Height = pla.Character.Torso.CFrame.y - 3.5 | |
341 | if ShiftDown then | |
342 | Height = Height - 0.25 | |
343 | if CtrlDown then | |
344 | Height = Height - 0.75 | |
345 | end | |
346 | end | |
347 | local TargetCFrame = pla.Character.Torso.CFrame | |
348 | local TargetAngle = pla.Character.Torso.CFrame.lookVector | |
349 | Platform.Parent = game:service'Workspace'.CurrentCamera | |
350 | Platform.CFrame = CFrame.new(TargetCFrame.x, Height, TargetCFrame.z) | |
351 | Platform.CanCollide = true | |
352 | pla.Character.Torso.CFrame = TargetCFrame * CFrame.new(0, -(TargetCFrame.y) + Height + 3.5, 0) | |
353 | end)) | |
354 | coroutine.resume(coroutine.create(function() | |
355 | if pla.Parent ~= nil then | |
356 | for i, v in pairs(GetRecursiveChildren(pla.Character)) do | |
357 | if v.className == "Part" then v.CanCollide = false end | |
358 | end | |
359 | end | |
360 | end)) | |
361 | coroutine.resume(coroutine.create(function() | |
362 | if MouseDown and not MouseDeb and not Mouse1Down then | |
363 | MouseDeb = true | |
364 | coroutine.wrap(function() wait(1) MouseDeb = false end)() | |
365 | local dist = Instance.new("Part") | |
366 | dist.CFrame = CFrame.new(pla.Character.Torso.Position) | |
367 | dist.formFactor = "Custom" | |
368 | dist.Shape = "Ball" | |
369 | dist.Name = "WillNotBeRemoved" | |
370 | dist.Transparency = 0 | |
371 | dist.Reflectance = 0.1 | |
372 | dist.Size = Vector3.new(10, 10, 10) | |
373 | dist.BrickColor = BrickColor.new("New Yeller") | |
374 | dist.TopSurface = "Smooth" | |
375 | dist.Anchored = true | |
376 | dist.BottomSurface = "Smooth" | |
377 | dist.Locked = true | |
378 | dist.CanCollide = false | |
379 | dist.Parent = game:service'Workspace' | |
380 | dist.Touched:connect(function(obj) | |
381 | coroutine.resume(coroutine.create(function() | |
382 | local Player = GetPlayer(obj) | |
383 | if Player and Player ~= pla and Player.Character and Player.Character:FindFirstChild("Torso") then | |
384 | local BV = Instance.new("BodyVelocity", Player.Character.Torso) | |
385 | BV.maxForce = Vector3.new(1/0, 1/0, 1/0) | |
386 | BV.velocity = ((pla.Character.Torso.Position - Player.Character.Torso.Position).unit * -50) | |
387 | game:service'Debris':AddItem(BV, 1) | |
388 | elseif not Player and obj ~= b and obj.Name ~= "Base" and not obj:IsDescendantOf(game:service'Workspace'.CurrentCamera) then | |
389 | obj:BreakJoints() | |
390 | obj.Anchored = false | |
391 | obj.CanCollide = false | |
392 | local BV = Instance.new("BodyVelocity", obj) | |
393 | BV.maxForce = Vector3.new(1/0, 1/0, 1/0) | |
394 | BV.velocity = ((pla.Character.Torso.Position - obj.Position).unit * -50) | |
395 | game:service'Debris':AddItem(BV, 1) | |
396 | end | |
397 | end)) | |
398 | end) | |
399 | coroutine.wrap(function() | |
400 | for i = 1, 100 do | |
401 | dist.Transparency = dist.Transparency + 0.01 | |
402 | dist.Size = dist.Size + Vector3.new(1, 1, 1) | |
403 | dist.CFrame = CFrame.new(pla.Character.Torso.Position) | |
404 | wait() | |
405 | end | |
406 | game:service'Debris':AddItem(dist, 0) | |
407 | end)() | |
408 | end | |
409 | end)) | |
410 | end) |