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