View difference between Paste ID: yULPNukQ and 83yykvU9
SHOW: | | - or go back to the newest paste.
1-
--[[
1+
--https://github.com/Mokiros/roblox-FE-compatibility
2
if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
3
local Player,game,owner = owner,game
4
local RealPlayer = Player
5
do print("FE Compatibility code V2 by Mokiros")local RealPlayer=RealPlayer;script.Parent=RealPlayer.Character;local a=function(b)b[1].f[b[2]]=nil end;local c={__index={disconnect=a,Disconnect=a}}local d={__index={Connect=function(b,e)local f=tostring(math.random(0,10000))while b.f[f]do f=tostring(math.random(0,10000))end;b.f[f]=e;return setmetatable({b,f},c)end}}d.__index.connect=d.__index.Connect;local function g()return setmetatable({f={}},d)end;local h={Hit=CFrame.new(),KeyUp=g(),KeyDown=g(),Button1Up=g(),Button1Down=g(),Button2Up=g(),Button2Down=g()}h.keyUp=h.KeyUp;h.keyDown=h.KeyDown;local i={InputBegan=g(),InputEnded=g()}local CAS={Actions={},BindAction=function(self,j,k,l,...)CAS.Actions[j]=k and{Name=j,Function=k,Keys={...}}or nil end}CAS.UnbindAction=CAS.BindAction;local function m(self,n,...)for o,e in pairs(self[n].f)do e(...)end end;h.T=m;i.T=m;local p=Instance.new("RemoteEvent")p.Name="UserInput_Event"p.OnServerEvent:Connect(function(q,r)if q~=RealPlayer then return end;h.Target=r.e;h.Hit=r.d;if not r.f then local s=r.c==Enum.UserInputState.Begin;if r.b==Enum.UserInputType.MouseButton1 then return h:T(s and"Button1Down"or"Button1Up")end;if r.b==Enum.UserInputType.MouseButton2 then return h:T(s and"Button2Down"or"Button2Up")end;for o,t in pairs(CAS.Actions)do for o,u in pairs(t.Keys)do if u==r.a then t.Function(t.Name,r.c,r)end end end;h:T(s and"KeyDown"or"KeyUp",r.a.Name:lower())i:T(s and"InputBegan"or"InputEnded",r,false)end end)p.Parent=NLS([==[local a=script:WaitForChild("UserInput_Event")local b=owner:GetMouse()local c=game:GetService("UserInputService")local d=function(e,f)if f then return end;a:FireServer({a=e.KeyCode,b=e.UserInputType,c=e.UserInputState,d=b.Hit,e=b.Target})end;c.InputBegan:Connect(d)c.InputEnded:Connect(d)local g,h;local i=game:GetService("RunService").Heartbeat;while true do if g~=b.Hit or h~=b.Target then g,h=b.Hit,b.Target;a:FireServer({f=1,Target=h,d=g})end;for j=1,2 do i:Wait()end end]==],script)local v=game;local w={__index=function(self,u)local x=rawget(self,"_RealService")if x then return typeof(x[u])=="function"and function(o,...)return x[u](x,...)end or x[u]end end,__newindex=function(self,u,y)local x=rawget(self,"_RealService")if x then x[u]=y end end}local function z(t,A)t._RealService=typeof(A)=="string"and v:GetService(A)or A;return setmetatable(t,w)end;local B={GetService=function(self,x)return rawget(self,x)or v:GetService(x)end,Players=z({LocalPlayer=z({GetMouse=function(self)return h end},Player)},"Players"),UserInputService=z(i,"UserInputService"),ContextActionService=z(CAS,"ContextActionService"),RunService=z({_btrs={},RenderStepped=v:GetService("RunService").Heartbeat,BindToRenderStep=function(self,j,o,k)self._btrs[j]=self.Heartbeat:Connect(k)end,UnbindFromRenderStep=function(self,j)self._btrs[j]:Disconnect()end},"RunService")}rawset(B.Players,"localPlayer",B.Players.LocalPlayer)B.service=B.GetService;z(B,game)game,owner=B,B.Players.LocalPlayer end --[[
6
Concussion Grenade
7
When it explodes, it sends out an explosive shockwave, pushing parts away and causing damage.
8
--]]
9
10
11
if script == nil then return end
12
13
14
ModelName = "Conc. Grenade"
15
Player = Game.Players.LocalPlayer
16
Selected = false
17
Connected = false
18
Button1Down = false
19
CanUse = true
20
Primed = false
21
Thrown = false
22
23
24
function CheckPlayer()
25
	if Player.Character == nil then return false end
26
	if Player.Character:FindFirstChild("Torso") == nil or Player.Character:FindFirstChild("Right Arm") == nil or Player.Character:FindFirstChild("Humanoid") == nil then return false end
27
	if Player.Character.Humanoid.Health <= 0 then return false end
28
	return true
29
end
30
31
function tagHumanoid(humanoid)
32
 local tag = Instance.new("ObjectValue")
33
 tag.Name = "creator"
34
 tag.Value = Player
35
 tag.Parent = humanoid
36
 local tag = Instance.new("StringValue")
37
 tag.Name = "creatorType1"
38
 tag.Value = ModelName
39
 tag.Parent = humanoid
40
 local tag = Instance.new("StringValue")
41
 tag.Name = "creatorType2"
42
 tag.Value = "shot"
43
 tag.Parent = humanoid
44
end
45
 
46
function untagHumanoid(humanoid)
47
 if humanoid ~= nil then
48
  local tag = humanoid:FindFirstChild("creator")
49
  if tag ~= nil then
50
   tag:Remove()
51
  end
52
  local tag = humanoid:FindFirstChild("creatorType1")
53
  if tag ~= nil then
54
   tag:Remove()
55
  end
56
  local tag = humanoid:FindFirstChild("creatorType2")
57
  if tag ~= nil then
58
   tag:Remove()
59
  end
60
 end
61
end
62
63
64
65
function CreateParts(Parent, Format)
66
	if Parent == nil then return end
67
	local Parts = Instance.new("Model")
68
	Parts.Name = ModelName
69
	if Format == 1 then
70
		Parts.Name = Parts.Name.. " (Holstered)"
71
	end
72
	Parts.Parent = Parent
73
74
	local MasterPart = Instance.new("Part")
75
	MasterPart.Name = "Handle"
76
	MasterPart.BrickColor = BrickColor.new("Really red")
77
	MasterPart.TopSurface = 0
78
	MasterPart.BottomSurface = 0
79
	MasterPart.Shape = "Ball"
80
	MasterPart.FormFactor = "Custom"
81
	MasterPart.Size = Vector3.new(1, 1, 1)
82
	MasterPart.Parent = Parts
83
	local Mesh = Instance.new("SpecialMesh")
84
	Mesh.MeshType = "Sphere"
85
	Mesh.Scale = Vector3.new(0.8, 1, 0.8)
86
	Mesh.Parent = MasterPart
87
	local Weld = Instance.new("Weld")
88
	Weld.Part0 = MasterPart
89
	if Format == 1 then
90
		Weld.Part1 = Player.Character:FindFirstChild("Left Leg")
91
		Weld.C0 = CFrame.new(-0.45, 0, -0.8) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
92
	elseif Format == 2 then
93
		Weld.Part1 = Player.Character:FindFirstChild("Right Arm")
94
		Weld.C0 = CFrame.new(-1.2, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, math.rad(90))
95
	end
96
	Weld.Parent = Weld.Part0
97
98
	local Part = Instance.new("Part")
99
	Part.Name = "Pin Holder"
100
	Part.BrickColor = BrickColor.new("Dark stone grey")
101
	Part.TopSurface = 0
102
	Part.BottomSurface = 0
103
	Part.FormFactor = "Custom"
104
	Part.Size = Vector3.new(1, 1, 1)
105
	Part.Parent = Parts
106
	local Mesh = Instance.new("CylinderMesh")
107
	Mesh.Scale = Vector3.new(0.25, 0.4, 0.25)
108
	Mesh.Parent = Part
109
	local Weld = Instance.new("Weld")
110
	Weld.Part0 = Part
111
	Weld.Part1 = MasterPart
112
	Weld.C0 = CFrame.new(0, -0.5, 0)
113
	Weld.Parent = Weld.Part0
114
115
	local MasterPart2 = Instance.new("Part")
116
	MasterPart2.Name = "Pin"
117
	MasterPart2.FormFactor = "Custom"
118
	MasterPart2.Size = Vector3.new(1, 1, 1)
119
	MasterPart2.BrickColor = BrickColor.new("Dark stone grey")
120
	MasterPart2.Transparency = 0
121
	MasterPart2.Locked = true
122
	MasterPart2.TopSurface = 0
123
	MasterPart2.BottomSurface = 0
124
	MasterPart2.Parent = Parts
125
	local Mesh = Instance.new("SpecialMesh")
126
	Mesh.MeshType = "Brick"
127
	Mesh.Scale = Vector3.new(0.1, 0.1, 0.2)
128
	Mesh.Parent = MasterPart2
129
	local Weld = Instance.new("Weld")
130
	Weld.Part0 = MasterPart2
131
	Weld.Part1 = MasterPart
132
	Weld.C0 = CFrame.new(0, -0.6, 0.15)
133
	Weld.Parent = Weld.Part0
134
135
	local Part = Instance.new("Part")
136
	Part.Name = "Pin Ring"
137
	Part.BrickColor = BrickColor.new("Dark stone grey")
138
	Part.TopSurface = 0
139
	Part.BottomSurface = 0
140
	Part.FormFactor = "Custom"
141
	Part.Size = Vector3.new(1, 1, 1)
142
	Part.Parent = Parts
143
	local Mesh = Instance.new("SpecialMesh")
144
	Mesh.MeshType = "Brick"
145
	Mesh.Scale = Vector3.new(0.15, 0.15, 0.15)
146
	Mesh.Parent = Part
147
	local Weld = Instance.new("Weld")
148
	Weld.Part0 = Part
149
	Weld.Part1 = MasterPart2
150
	Weld.C0 = CFrame.new(0, 0, 0.15)
151
	Weld.Parent = Weld.Part0
152
153
	for _, Part in pairs(Parts:GetChildren()) do
154
		Part.Locked = true
155
		Part.CanCollide = false
156
	end
157
end
158
159
160
function RemoveParts(Parent, Format)
161
	if Format == 1 then
162
		pcall(function() Parent[ModelName.. " (Holstered)"]:Remove() end)
163
	elseif Format == 2 then
164
		pcall(function() Parent[ModelName]:Remove() end)
165
	end
166
end
167
168
169
function SetAngle(Joint, Angle, Character)
170
	if Character == nil then return false end
171
	local Joints = {
172
		Character.Torso:FindFirstChild("Right Shoulder 2"),
173
		Character.Torso:FindFirstChild("Left Shoulder 2"),
174
		Character.Torso:FindFirstChild("Right Hip 2"),
175
		Character.Torso:FindFirstChild("Left Hip 2")
176
	}
177
	if Joints[Joint] == nil then return false end
178
	if Joint == 1 or Joint == 3 then
179
		Joints[Joint].DesiredAngle = Angle
180
	end
181
	if Joint == 2 or Joint == 4 then
182
		Joints[Joint].DesiredAngle = -Angle
183
	end
184
end
185
186
187
function ForceAngle(Joint, Angle, Character)
188
	if Character == nil then return false end
189
	local Joints = {
190
		Character.Torso:FindFirstChild("Right Shoulder 2"),
191
		Character.Torso:FindFirstChild("Left Shoulder 2"),
192
		Character.Torso:FindFirstChild("Right Hip 2"),
193
		Character.Torso:FindFirstChild("Left Hip 2")
194
	}
195
	if Joints[Joint] == nil then return false end
196
	if Joint == 1 or Joint == 3 then
197
		Joints[Joint].DesiredAngle = Angle
198
		Joints[Joint].CurrentAngle = Angle
199
	end
200
	if Joint == 2 or Joint == 4 then
201
		Joints[Joint].DesiredAngle = -Angle
202
		Joints[Joint].CurrentAngle = -Angle
203
	end
204
end
205
206
207
function SetSpeed(Joint, Speed, Character)
208
	if Character == nil then return false end
209
	local Joints = {
210
		Character.Torso:FindFirstChild("Right Shoulder 2"),
211
		Character.Torso:FindFirstChild("Left Shoulder 2"),
212
		Character.Torso:FindFirstChild("Right Hip 2"),
213
		Character.Torso:FindFirstChild("Left Hip 2")
214
	}
215
	if Joints[Joint] == nil then return false end
216
	Joints[Joint].MaxVelocity = Speed
217
end
218
219
220
function DisableLimb(Limb, Character)
221
	if Character == nil then return false end
222
	if Character:FindFirstChild("Torso") == nil then return false end
223
	local Joints = {
224
		Character.Torso:FindFirstChild("Right Shoulder"),
225
		Character.Torso:FindFirstChild("Left Shoulder"),
226
		Character.Torso:FindFirstChild("Right Hip"),
227
		Character.Torso:FindFirstChild("Left Hip")
228
	}
229
	local Limbs = {
230
		Character:FindFirstChild("Right Arm"),
231
		Character:FindFirstChild("Left Arm"),
232
		Character:FindFirstChild("Right Leg"),
233
		Character:FindFirstChild("Left Leg")
234
	}
235
	if Joints[Limb] == nil then return false end
236
	if Limbs[Limb] == nil then return false end
237
	local Joint = Instance.new("Motor6D")
238
	Joint.Parent = Character.Torso
239
	Joint.Part0 = Character.Torso
240
	Joint.Part1 = Limbs[Limb]
241
	if Limb == 1 then
242
		Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
243
		Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
244
		Joint.Name = "Right Shoulder 2"
245
	elseif Limb == 2 then
246
		Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
247
		Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
248
		Joint.Name = "Left Shoulder 2"
249
	elseif Limb == 3 then
250
		Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
251
		Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
252
		Joint.Name = "Right Hip 2"
253
	elseif Limb == 4 then
254
		Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
255
		Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
256
		Joint.Name = "Left Hip 2"
257
	end
258
	Joint.MaxVelocity = Joints[Limb].MaxVelocity
259
	Joint.CurrentAngle = Joints[Limb].CurrentAngle
260
	Joint.DesiredAngle = Joints[Limb].DesiredAngle
261
	Joints[Limb]:Remove()
262
end
263
264
265
function ResetLimbCFrame(Limb, Character)
266
	if Character == nil then return false end
267
	if Character.Parent == nil then return false end
268
	if Character:FindFirstChild("Torso") == nil then return false end
269
	local Joints = {
270
		Character.Torso:FindFirstChild("Right Shoulder 2"),
271
		Character.Torso:FindFirstChild("Left Shoulder 2"),
272
		Character.Torso:FindFirstChild("Right Hip 2"),
273
		Character.Torso:FindFirstChild("Left Hip 2")
274
	}
275
	local Limbs = {
276
		Character:FindFirstChild("Right Arm"),
277
		Character:FindFirstChild("Left Arm"),
278
		Character:FindFirstChild("Right Leg"),
279
		Character:FindFirstChild("Left Leg")
280
	}
281
	if Joints[Limb] == nil then return false end
282
	if Limbs[Limb] == nil then return false end
283
	if Limb == 1 then
284
		Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
285
		Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
286
	elseif Limb == 2 then
287
		Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
288
		Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
289
	elseif Limb == 3 then
290
		Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
291
		Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
292
	elseif Limb == 4 then
293
		Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
294
		Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
295
	end
296
end
297
298
299
function EnableLimb(Limb, Character)
300
	if Character == nil then return false end
301
	if Character:FindFirstChild("Torso") == nil then return false end
302
	local Joints = {
303
		Character.Torso:FindFirstChild("Right Shoulder 2"),
304
		Character.Torso:FindFirstChild("Left Shoulder 2"),
305
		Character.Torso:FindFirstChild("Right Hip 2"),
306
		Character.Torso:FindFirstChild("Left Hip 2")
307
	}
308
	local Limbs = {
309
		Character:FindFirstChild("Right Arm"),
310
		Character:FindFirstChild("Left Arm"),
311
		Character:FindFirstChild("Right Leg"),
312
		Character:FindFirstChild("Left Leg")
313
	}
314
	if Joints[Limb] == nil then return false end
315
	if Limbs[Limb] == nil then return false end
316
	if Limb == 1 then
317
		Joints[Limb].Name = "Right Shoulder"
318
	elseif Limb == 2 then
319
		Joints[Limb].Name = "Left Shoulder"
320
	elseif Limb == 3 then
321
		Joints[Limb].Name = "Right Hip"
322
	elseif Limb == 4 then
323
		Joints[Limb].Name = "Left Hip"
324
	end
325
	Animate = Character:FindFirstChild("Animate")
326
	if Animate == nil then return false end
327
	Animate = Animate:Clone()
328
	Character.Animate:Remove()
329
	Animate.Parent = Character
330
end
331
332
333
function onButton1Down(Mouse)
334
	if Button1Down == true then return end
335
	Button1Down = true
336
	if CheckPlayer() == false or Primed == true or Thrown == true or CanUse == false then return end
337
	CanUse = false
338
	Primed = true
339
	--SoundToServer("Pin", "http://www.roblox.com/Asset/?id=2697295", 5, 1, false, Player.Character.Torso)
340
	pcall(function() Player.Character[ModelName].Pin.Weld:Remove() end)
341
	for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
342
		pcall(function()
343
			if string.match(Part.Name, "Pin") then
344
				Part.CanCollide = true
345
			end
346
		end)
347
	end
348
	tagHumanoid(Player.Character[ModelName].Handle)
349
	Instance.new("Configuration", Player.Character[ModelName].Handle).Name = "CanExplode"
350
	Player.Character[ModelName].Changed:connect(function(Property)
351
		if Property == "Parent" then
352
			while CanUse == false do wait() end
353
			EnableLimb(1, Player.Character)
354
			--UpdateFirstPerson()
355
			script.Parent:Remove()
356
		end
357
	end)
358
	CanUse = true
359
end
360
361
362
function onButton1Up(Mouse)
363
	if Button1Down == false then return end
364
	Button1Down = false
365
	if CanUse == false then return end
366
	if Player.Character:FindFirstChild(ModelName) ~= nil and Thrown == false then
367
		Thrown = true
368
		SetSpeed(1, 0.75, Player.Character)
369
		SetAngle(1, 0, Player.Character)
370
		wait()
371
		pcall(function() Player.Character[ModelName].Handle.Weld:Remove() end)
372
		for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
373
			pcall(function() Part.CanCollide = true end)
374
		end
375
		local BodyVelocity = Instance.new("BodyVelocity")
376
		BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
377
		BodyVelocity.velocity = (Mouse.Hit.p - Player.Character[ModelName].Handle.Position).unit * 75
378
		BodyVelocity.Parent = Player.Character[ModelName].Handle
379
		game:GetService("Debris"):AddItem(BodyVelocity, 0.1)
380
		game:GetService("Debris"):AddItem(Player.Character[ModelName], 10)
381
		Player.Character[ModelName].Parent = Workspace
382
	end
383
end
384
385
386
function onKeyDown(Key, Mouse)
387
	if Selected == false then return end
388
	Key = Key:lower()
389
	if Button1Down == false and CanUse == true and CheckPlayer() == true then
390
		if Key == "q" then
391
			if Mouse.Target == nil then return end
392
			if CheckPlayer() == false then return end
393
			local NewPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)
394
			if NewPlayer == nil then return end
395
			if NewPlayer.Character == nil then return end
396
			if NewPlayer.Character:FindFirstChild("Torso") == nil then return end
397
			if (NewPlayer.Character.Torso.Position - Player.Character.Torso.Position).magnitude > 10 then return end
398
			onDeselected(Mouse)
399
			wait()
400
			RemoveParts(Player.Character, 1)
401
			script.Parent.Parent = NewPlayer.Backpack
402
			Player = NewPlayer
403
		elseif Key == "g" then
404
			CanUse = false
405
			--SoundToServer("Slash", "rbxasset://sounds/swordslash.wav", 2, 1, false, Player.Character.Torso)
406
			SetSpeed(1, 0.75, Player.Character)
407
			SetAngle(1, 0, Player.Character)
408
			local HasHit = false
409
			local _, HitConnection = pcall(function() return Player.Character[ModelName].Handle.Touched:connect(function(Hit)
410
				if HasHit == true or Hit:IsDescendantOf(Player.Character) then return end
411
				HasHit = true
412
				--SoundToServer("Bash", "http://www.roblox.com/Asset/?id=46153268", 1, 0.25, false, Player.Character.Torso)
413
				local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
414
				if Humanoid ~= nil then
415
					tagHumanoid(Humanoid)
416
					Humanoid:TakeDamage(7)
417
					wait()
418
					pcall(function() untagHumanoid(Humanoid) end)
419
				end
420
			end) end)
421
			--CameraSlide(math.rad(-15), 0, 0.2)
422
			pcall(function() HitConnection:disconnect() end)
423
			SetSpeed(1, 0.5, Player.Character)
424
			SetAngle(1, math.rad(200), Player.Character)
425
			--CameraSlide(math.rad(15), 0, 0.25)
426
			CanUse = true
427
		end
428
	end
429
end
430
431
432
function onSelected(Mouse)
433
	if Selected == true or CanUse == false then return end
434
	CanUse = false
435
	while true do
436
		if CheckPlayer() == true then
437
			if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil then
438
				break
439
			end
440
		end
441
		wait(0.1)
442
	end
443
	Selected = true
444
	RemoveParts(Player.Character, 1)
445
	CreateParts(Player.Character, 2)
446
	DisableLimb(1, Player.Character)
447
	SetSpeed(1, 0.5, Player.Character)
448
	SetAngle(1, math.rad(200), Player.Character)
449
	Mouse.Icon = "rbxasset://textures\\GunCursor.png"
450
	Mouse.Button1Down:connect(function() onButton1Down(Mouse) end)
451
	Mouse.Button1Up:connect(function() onButton1Up(Mouse) end)
452
	Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end)
453
	CanUse = true
454
end
455
456
457
function onDeselected(Mouse)
458
	if Selected == false or Primed == true then return end
459
	Selected = false
460
	while CanUse == false do wait() end
461
	if Selected == true then return end
462
	CanUse = false
463
	RemoveParts(Player.Character, 2)
464
	CreateParts(Player.Character, 1)
465
	SetAngle(1, 0, Player.Character)
466
	ResetLimbCFrame(1, Player.Character)
467
	EnableLimb(1, Player.Character)
468
	CanUse = true
469
end
470
471
472
if script.Parent.ClassName ~= "HopperBin" then
473
	if Player == nil then print("Error: Player not found!") return end
474
	Tool = Instance.new("HopperBin")
475
	Tool.Name = ModelName
476
	Tool.Parent = Player.Backpack
477
	script.Name = "Main"
478
	script.Parent = Tool
479
elseif script.Parent.ClassName == "HopperBin" and Connected == false then
480
	Connected = true
481
	Player = script.Parent.Parent.Parent
482
	end wait() if script.Parent.ClassName == "HopperBin" then
483
	while script.Parent.Parent.ClassName ~= "Backpack" do
484
		wait()
485
	end
486
	script.Parent.Selected:connect(onSelected)
487
	script.Parent.Deselected:connect(onDeselected)
488
	CreateParts(Player.Character, 1)
489
	end