Advertisement
lafur

Untitled

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