Hugo1234cool

Untitled

Mar 21st, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.01 KB | None | 0 0
  1. --[[
  2. Mustard Gas Grenade
  3. A grenade that emits airborn sulfur mustard, filling the lungs and causing the skin to bubble.
  4. --]]--https://github.com/Mokiros/roblox-FE-compatibility
  5. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  6. local Player,game,owner = owner,game
  7. local RealPlayer = Player
  8. 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
  9.  
  10.  
  11. if script == nil then return end
  12.  
  13.  
  14. ModelName = "Mustard Gas G."
  15. Player = script:FindFirstChild("Player") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("MasterSkips")
  16. Selected = false
  17. Connected = false
  18. Button1Down = false
  19. CanUse = true
  20. Thrown = false
  21. FirstPerson = game:GetService("InsertService"):LoadAsset(60568552)["FirstPerson"].Value
  22. MouseAim = game:GetService("InsertService"):LoadAsset(61527949)["MouseAim"].Value
  23.  
  24.  
  25. function CheckPlayer()
  26. if Player.Character == nil then return false end
  27. if Player.Character:FindFirstChild("Torso") == nil or Player.Character:FindFirstChild("Right Arm") == nil or Player.Character:FindFirstChild("Humanoid") == nil then return false end
  28. if Player.Character.Humanoid.Health <= 0 then return false end
  29. return true
  30. end
  31.  
  32.  
  33. loadstring(game:GetService("InsertService"):LoadAsset(65363615)["tagHumanoid"].Value)()
  34.  
  35.  
  36. loadstring(game:GetService("InsertService"):LoadAsset(63178291)["CameraPunch"].Value)()
  37.  
  38.  
  39. loadstring(game:GetService("InsertService"):LoadAsset(62991657)["PacketFunctions"].Value)()
  40.  
  41.  
  42. function CreateParts(Parent, Format)
  43. if Parent == nil then return end
  44. local Parts = Instance.new("Model")
  45. Parts.Name = ModelName
  46. if Format == 1 then
  47. Parts.Name = Parts.Name.. " (Holstered)"
  48. end
  49. Parts.Parent = Parent
  50.  
  51. local MasterPart = Instance.new("Part")
  52. MasterPart.Name = "Handle"
  53. MasterPart.BrickColor = BrickColor.new("Bright yellow")
  54. MasterPart.TopSurface = 0
  55. MasterPart.BottomSurface = 0
  56. MasterPart.FormFactor = "Custom"
  57. MasterPart.Size = Vector3.new(0.4, 0.9, 0.4)
  58. MasterPart.Parent = Parts
  59. Instance.new("SpecialMesh", MasterPart).MeshType = "Head"
  60. local Weld = Instance.new("Weld")
  61. Weld.Part0 = MasterPart
  62. if Format == 1 then
  63. Weld.Part1 = Player.Character:FindFirstChild("Left Leg")
  64. Weld.C0 = CFrame.new(0.75, 0, 0.7) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  65. elseif Format == 2 then
  66. Weld.Part1 = Player.Character:FindFirstChild("Right Arm")
  67. Weld.C0 = CFrame.new(0, 0, 1.2) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  68. end
  69. Weld.Parent = Weld.Part0
  70.  
  71. local Part = Instance.new("Part")
  72. Part.Name = "Stripe Top"
  73. Part.BrickColor = BrickColor.new("Really black")
  74. Part.TopSurface = 0
  75. Part.BottomSurface = 0
  76. Part.FormFactor = "Custom"
  77. Part.Size = Vector3.new(0.45, 0.2, 0.45)
  78. Part.Parent = Parts
  79. Instance.new("CylinderMesh", Part).Scale = Vector3.new(1, 0.1, 1)
  80. local Weld = Instance.new("Weld")
  81. Weld.Part0 = Part
  82. Weld.Part1 = MasterPart
  83. Weld.C0 = CFrame.new(0, -0.2, 0)
  84. Weld.Parent = Weld.Part0
  85.  
  86. local Part = Instance.new("Part")
  87. Part.Name = "Stripe Bottom"
  88. Part.BrickColor = BrickColor.new("Really black")
  89. Part.TopSurface = 0
  90. Part.BottomSurface = 0
  91. Part.FormFactor = "Custom"
  92. Part.Size = Vector3.new(0.45, 0.2, 0.45)
  93. Part.Parent = Parts
  94. Instance.new("CylinderMesh", Part).Scale = Vector3.new(1, 0.1, 1)
  95. local Weld = Instance.new("Weld")
  96. Weld.Part0 = Part
  97. Weld.Part1 = MasterPart
  98. Weld.C0 = CFrame.new(0, 0.2, 0)
  99. Weld.Parent = Weld.Part0
  100.  
  101. local Part = Instance.new("Part")
  102. Part.Name = "Stripe Center"
  103. Part.BrickColor = BrickColor.new("CGA brown")
  104. Part.TopSurface = 0
  105. Part.BottomSurface = 0
  106. Part.FormFactor = "Custom"
  107. Part.Size = Vector3.new(0.425, 0.4, 0.425)
  108. Part.Parent = Parts
  109. Instance.new("CylinderMesh", Part)
  110. local Weld = Instance.new("Weld")
  111. Weld.Part0 = Part
  112. Weld.Part1 = MasterPart
  113. Weld.Parent = Weld.Part0
  114.  
  115. local Part = Instance.new("Part")
  116. Part.Name = "Pin Holder"
  117. Part.BrickColor = BrickColor.new("Dark stone grey")
  118. Part.TopSurface = 0
  119. Part.BottomSurface = 0
  120. Part.FormFactor = "Custom"
  121. Part.Size = Vector3.new(0.2, 0.4, 0.2)
  122. Part.Parent = Parts
  123. Instance.new("CylinderMesh", Part)
  124. local Weld = Instance.new("Weld")
  125. Weld.Part0 = Part
  126. Weld.Part1 = MasterPart
  127. Weld.C0 = CFrame.new(0, -0.5, 0)
  128. Weld.Parent = Weld.Part0
  129.  
  130. local MasterPart2 = Instance.new("Part")
  131. MasterPart2.Name = "Pin"
  132. MasterPart2.BrickColor = BrickColor.new("Dark stone grey")
  133. MasterPart2.TopSurface = 0
  134. MasterPart2.BottomSurface = 0
  135. MasterPart2.FormFactor = "Custom"
  136. MasterPart2.Size = Vector3.new(0.2, 0.2, 0.2)
  137. MasterPart2.Parent = Parts
  138. local Mesh = Instance.new("SpecialMesh", MasterPart2)
  139. Mesh.MeshType = "Brick"
  140. Mesh.Scale = Vector3.new(0.3, 0.1, 0.1)
  141. local Weld = Instance.new("Weld")
  142. Weld.Part0 = MasterPart2
  143. Weld.Part1 = MasterPart
  144. Weld.C0 = CFrame.new(0.125, -0.6, 0)
  145. Weld.Parent = Weld.Part0
  146.  
  147. local Part = Instance.new("Part")
  148. Part.Name = "Pin Ring"
  149. Part.BrickColor = BrickColor.new("Dark stone grey")
  150. Part.TopSurface = 0
  151. Part.BottomSurface = 0
  152. Part.FormFactor = "Custom"
  153. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  154. Part.Parent = Parts
  155. Instance.new("CylinderMesh", Part).Scale = Vector3.new(0.75, 0.1, 0.75)
  156. local Weld = Instance.new("Weld")
  157. Weld.Part0 = Part
  158. Weld.Part1 = MasterPart2
  159. Weld.C0 = CFrame.new(0.1, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  160. Weld.Parent = Weld.Part0
  161.  
  162. for _, Part in pairs(Parts:GetChildren()) do
  163. Part.Locked = true
  164. Part.CanCollide = false
  165. end
  166. end
  167.  
  168.  
  169. function RemoveParts(Parent, Format)
  170. if Format == 1 then
  171. pcall(function() Parent[ModelName.. " (Holstered)"]:Remove() end)
  172. elseif Format == 2 then
  173. pcall(function() Parent[ModelName]:Remove() end)
  174. end
  175. end
  176.  
  177.  
  178. function SetAngle(Joint, Angle, Character)
  179. if Character == nil then return false end
  180. local Joints = {
  181. Character.Torso:FindFirstChild("Right Shoulder 2"),
  182. Character.Torso:FindFirstChild("Left Shoulder 2"),
  183. Character.Torso:FindFirstChild("Right Hip 2"),
  184. Character.Torso:FindFirstChild("Left Hip 2")
  185. }
  186. if Joints[Joint] == nil then return false end
  187. if Joint == 1 or Joint == 3 then
  188. Joints[Joint].DesiredAngle = Angle
  189. end
  190. if Joint == 2 or Joint == 4 then
  191. Joints[Joint].DesiredAngle = -Angle
  192. end
  193. end
  194.  
  195.  
  196. function ForceAngle(Joint, Angle, Character)
  197. if Character == nil then return false end
  198. local Joints = {
  199. Character.Torso:FindFirstChild("Right Shoulder 2"),
  200. Character.Torso:FindFirstChild("Left Shoulder 2"),
  201. Character.Torso:FindFirstChild("Right Hip 2"),
  202. Character.Torso:FindFirstChild("Left Hip 2")
  203. }
  204. if Joints[Joint] == nil then return false end
  205. if Joint == 1 or Joint == 3 then
  206. Joints[Joint].DesiredAngle = Angle
  207. Joints[Joint].CurrentAngle = Angle
  208. end
  209. if Joint == 2 or Joint == 4 then
  210. Joints[Joint].DesiredAngle = -Angle
  211. Joints[Joint].CurrentAngle = -Angle
  212. end
  213. end
  214.  
  215.  
  216. function SetSpeed(Joint, Speed, Character)
  217. if Character == nil then return false end
  218. local Joints = {
  219. Character.Torso:FindFirstChild("Right Shoulder 2"),
  220. Character.Torso:FindFirstChild("Left Shoulder 2"),
  221. Character.Torso:FindFirstChild("Right Hip 2"),
  222. Character.Torso:FindFirstChild("Left Hip 2")
  223. }
  224. if Joints[Joint] == nil then return false end
  225. Joints[Joint].MaxVelocity = Speed
  226. end
  227.  
  228.  
  229. function DisableLimb(Limb, Character)
  230. if Character == nil then return false end
  231. if Character:FindFirstChild("Torso") == nil then return false end
  232. local Joints = {
  233. Character.Torso:FindFirstChild("Right Shoulder"),
  234. Character.Torso:FindFirstChild("Left Shoulder"),
  235. Character.Torso:FindFirstChild("Right Hip"),
  236. Character.Torso:FindFirstChild("Left Hip")
  237. }
  238. local Limbs = {
  239. Character:FindFirstChild("Right Arm"),
  240. Character:FindFirstChild("Left Arm"),
  241. Character:FindFirstChild("Right Leg"),
  242. Character:FindFirstChild("Left Leg")
  243. }
  244. if Joints[Limb] == nil then return false end
  245. if Limbs[Limb] == nil then return false end
  246. local Joint = Instance.new("Motor6D")
  247. Joint.Parent = Character.Torso
  248. Joint.Part0 = Character.Torso
  249. Joint.Part1 = Limbs[Limb]
  250. if Limb == 1 then
  251. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  252. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  253. Joint.Name = "Right Shoulder 2"
  254. elseif Limb == 2 then
  255. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  256. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  257. Joint.Name = "Left Shoulder 2"
  258. elseif Limb == 3 then
  259. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  260. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  261. Joint.Name = "Right Hip 2"
  262. elseif Limb == 4 then
  263. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  264. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  265. Joint.Name = "Left Hip 2"
  266. end
  267. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  268. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  269. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  270. Joints[Limb]:Remove()
  271. end
  272.  
  273.  
  274. function ResetLimbCFrame(Limb, Character)
  275. if Character == nil then return false end
  276. if Character.Parent == nil then return false end
  277. if Character:FindFirstChild("Torso") == nil then return false end
  278. local Joints = {
  279. Character.Torso:FindFirstChild("Right Shoulder 2"),
  280. Character.Torso:FindFirstChild("Left Shoulder 2"),
  281. Character.Torso:FindFirstChild("Right Hip 2"),
  282. Character.Torso:FindFirstChild("Left Hip 2")
  283. }
  284. local Limbs = {
  285. Character:FindFirstChild("Right Arm"),
  286. Character:FindFirstChild("Left Arm"),
  287. Character:FindFirstChild("Right Leg"),
  288. Character:FindFirstChild("Left Leg")
  289. }
  290. if Joints[Limb] == nil then return false end
  291. if Limbs[Limb] == nil then return false end
  292. if Limb == 1 then
  293. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  294. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  295. elseif Limb == 2 then
  296. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  297. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  298. elseif Limb == 3 then
  299. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  300. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  301. elseif Limb == 4 then
  302. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  303. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  304. end
  305. end
  306.  
  307.  
  308. function EnableLimb(Limb, Character)
  309. if Character == nil then return false end
  310. if Character:FindFirstChild("Torso") == nil then return false end
  311. local Joints = {
  312. Character.Torso:FindFirstChild("Right Shoulder 2"),
  313. Character.Torso:FindFirstChild("Left Shoulder 2"),
  314. Character.Torso:FindFirstChild("Right Hip 2"),
  315. Character.Torso:FindFirstChild("Left Hip 2")
  316. }
  317. local Limbs = {
  318. Character:FindFirstChild("Right Arm"),
  319. Character:FindFirstChild("Left Arm"),
  320. Character:FindFirstChild("Right Leg"),
  321. Character:FindFirstChild("Left Leg")
  322. }
  323. if Joints[Limb] == nil then return false end
  324. if Limbs[Limb] == nil then return false end
  325. if Limb == 1 then
  326. Joints[Limb].Name = "Right Shoulder"
  327. elseif Limb == 2 then
  328. Joints[Limb].Name = "Left Shoulder"
  329. elseif Limb == 3 then
  330. Joints[Limb].Name = "Right Hip"
  331. elseif Limb == 4 then
  332. Joints[Limb].Name = "Left Hip"
  333. end
  334. Animate = Character:FindFirstChild("Animate")
  335. if Animate == nil then return false end
  336. Animate = Animate:Clone()
  337. Character.Animate:Remove()
  338. Animate.Parent = Character
  339. end
  340.  
  341.  
  342. function onButton1Down(Mouse)
  343. if Button1Down == true then return end
  344. Button1Down = true
  345. if CheckPlayer() == false or Primed == true or Thrown == true or CanUse == false then return end
  346. CanUse = false
  347. Primed = true
  348. SoundToServer("Pin", "http://www.roblox.com/Asset/?id=2697295", 5, 1, false, Player.Character.Torso)
  349. pcall(function() Player.Character[ModelName].Pin.Weld:Remove() end)
  350. for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
  351. pcall(function()
  352. if string.match(Part.Name, "Pin") then
  353. Part.CanCollide = true
  354. end
  355. end)
  356. end
  357. Instance.new("Configuration", Player.Character[ModelName].Handle).Name = "CanExplode"
  358. SendToServer([[local MaxDistance = 30
  359. wait(4)
  360. local Sound = Instance.new("Sound")
  361. Sound.Name = "Hiss"
  362. Sound.SoundId = "rbxasset://sounds/Rocket whoosh 01.wav"
  363. Sound.Volume = 0.25
  364. Sound.Pitch = 2
  365. Sound.Parent = Source
  366. local Smoke1 = Instance.new("Smoke", Source)
  367. Smoke1.Color = Color3.new(218 / 255, 165 / 255, 32 / 255)
  368. Smoke1.Size = MaxDistance
  369. Smoke1.RiseVelocity = 0
  370. local Smoke2 = nil
  371. pcall(function()
  372. Smoke2 = Instance.new("Smoke", Source.Parent["Pin Holder"])
  373. Smoke2.Color = Color3.new(218 / 255, 165 / 255, 32 / 255)
  374. Smoke2.Size = MaxDistance / 9
  375. Smoke2.RiseVelocity = MaxDisance / 2
  376. end)
  377. for i = 0, 1, 0.00125 do
  378. local Amount = (i < 0.5 and i or (1 - i)) * 2
  379. Smoke1.Opacity = Amount * 0.3
  380. pcall(function() Smoke2.Opacity = Amount end)
  381. Sound.Volume = Amount
  382. Sound:Play()
  383. for _, Player in pairs(game:GetService("Players"):GetPlayers()) do
  384. if Player.Character ~= nil then
  385. if Player.Character:FindFirstChild("Head") ~= nil then
  386. local HasMask = false
  387. for _, Part in pairs(Player.Character:GetChildren()) do
  388. if Part.Name == "Gas Mask" then
  389. HasMask = true
  390. end
  391. end
  392. if HasMask == false then
  393. local Distance = (Player.Character.Head.Position - Source.Position).magnitude
  394. if Distance < MaxDistance then
  395. pcall(function() Player.Character.Humanoid:TakeDamage((((MaxDistance - Distance) / MaxDistance) * 0.5) * Amount) end)
  396. local StunGui = Instance.new("ScreenGui", Player.PlayerGui)
  397. StunGui.Name = "StunGui"
  398. local Yellow = Instance.new("Frame", StunGui)
  399. Yellow.Name = "Yellow"
  400. Yellow.BorderSizePixel = 0
  401. Yellow.BackgroundColor3 = Color3.new(218 / 255, 165 / 255, 32 / 255)
  402. Yellow.BackgroundTransparency = 0.95
  403. Yellow.Size = UDim2.new(2, 0, 2, 0)
  404. Yellow.Position = UDim2.new(-0.5, 0, -0.5, 0)
  405. coroutine.wrap(function()
  406. wait((((MaxDistance - Distance) / MaxDistance) * 2) * Amount)
  407. StunGui:Remove()
  408. end)()
  409. end
  410. end
  411. end
  412. end
  413. end
  414. wait()
  415. end
  416. Smoke1.Enabled = false
  417. pcall(function() Smoke2.Enabled = false end)
  418. wait(7.5)
  419. Source.Parent:Remove()]], "Smoke", {"Source", Player.Character[ModelName].Handle})
  420. Player.Character[ModelName].Changed:connect(function(Property)
  421. if Property == "Parent" then
  422. while CanUse == false do wait() end
  423. EnableLimb(1, Player.Character)
  424. UpdateFirstPerson()
  425. script.Parent:Remove()
  426. end
  427. end)
  428. CanUse = true
  429. end
  430.  
  431.  
  432. function onButton1Up(Mouse)
  433. if Button1Down == false then return end
  434. Button1Down = false
  435. if CanUse == false then return end
  436. if Player.Character:FindFirstChild(ModelName) ~= nil and Thrown == false then
  437. Thrown = true
  438. SetSpeed(1, 0.75, Player.Character)
  439. SetAngle(1, 0, Player.Character)
  440. wait()
  441. pcall(function() Player.Character[ModelName].Handle.Weld:Remove() end)
  442. for _, Part in pairs(Player.Character[ModelName]:GetChildren()) do
  443. pcall(function() Part.CanCollide = true end)
  444. end
  445. local BodyVelocity = Instance.new("BodyVelocity")
  446. BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  447. BodyVelocity.velocity = (Mouse.Hit.p - Player.Character[ModelName].Handle.Position).unit * 75
  448. BodyVelocity.Parent = Player.Character[ModelName].Handle
  449. game:GetService("Debris"):AddItem(BodyVelocity, 0.1)
  450. game:GetService("Debris"):AddItem(Player.Character[ModelName], 45)
  451. Player.Character[ModelName].Parent = Workspace
  452. end
  453. end
  454.  
  455.  
  456. function onKeyDown(Key, Mouse)
  457. if Selected == false then return end
  458. Key = Key:lower()
  459. if Button1Down == false and CanUse == true and CheckPlayer() == true then
  460. if Key == "q" then
  461. if Mouse.Target == nil then return end
  462. if CheckPlayer() == false then return end
  463. local NewPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)
  464. if NewPlayer == nil then return end
  465. if NewPlayer.Character == nil then return end
  466. if NewPlayer.Character:FindFirstChild("Torso") == nil then return end
  467. if (NewPlayer.Character.Torso.Position - Player.Character.Torso.Position).magnitude > 10 then return end
  468. onDeselected(Mouse)
  469. wait()
  470. RemoveParts(Player.Character, 1)
  471. script.Parent.Parent = NewPlayer.Backpack
  472. Player = NewPlayer
  473. elseif Key == "g" then
  474. CanUse = false
  475. SoundToServer("Slash", "rbxasset://sounds/swordslash.wav", 2, 1, false, Player.Character.Torso)
  476. SetSpeed(1, 0.75, Player.Character)
  477. SetAngle(1, 0, Player.Character)
  478. local HasHit = false
  479. local _, HitConnection = pcall(function() return Player.Character[ModelName].Handle.Touched:connect(function(Hit)
  480. if HasHit == true or Hit:IsDescendantOf(Player.Character) then return end
  481. HasHit = true
  482. SoundToServer("Bash", "http://www.roblox.com/Asset/?id=46153268", 1, 0.25, false, Player.Character.Torso)
  483. local Humanoid = Hit.Parent:FindFirstChild("Humanoid") or Hit.Parent.Parent:FindFirstChild("Humanoid")
  484. if Humanoid ~= nil then
  485. tagHumanoid(Humanoid)
  486. Humanoid:TakeDamage(7)
  487. wait()
  488. pcall(function() untagHumanoid(Humanoid) end)
  489. end
  490. end) end)
  491. CameraSlide(math.rad(-15), 0, 0.2)
  492. pcall(function() HitConnection:disconnect() end)
  493. SetSpeed(1, 0.5, Player.Character)
  494. SetAngle(1, math.rad(200), Player.Character)
  495. CameraSlide(math.rad(15), 0, 0.25)
  496. CanUse = true
  497. end
  498. end
  499. end
  500.  
  501.  
  502. function onSelected(Mouse)
  503. if Selected == true or CanUse == false then return end
  504. CanUse = false
  505. while true do
  506. if CheckPlayer() == true then
  507. if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil then
  508. break
  509. end
  510. end
  511. wait(0.1)
  512. end
  513. Selected = true
  514. RemoveParts(Player.Character, 1)
  515. CreateParts(Player.Character, 2)
  516. DisableLimb(1, Player.Character)
  517. SetSpeed(1, 0.5, Player.Character)
  518. SetAngle(1, math.rad(200), Player.Character)
  519. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  520. Mouse.Button1Down:connect(function() onButton1Down(Mouse) end)
  521. Mouse.Button1Up:connect(function() onButton1Up(Mouse) end)
  522. Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end)
  523. CanUse = true
  524. end
  525.  
  526.  
  527. function onDeselected(Mouse)
  528. if Selected == false or Primed == true then return end
  529. Selected = false
  530. while CanUse == false do wait() end
  531. if Selected == true then return end
  532. CanUse = false
  533. RemoveParts(Player.Character, 2)
  534. CreateParts(Player.Character, 1)
  535. SetAngle(1, 0, Player.Character)
  536. ResetLimbCFrame(1, Player.Character)
  537. EnableLimb(1, Player.Character)
  538. CanUse = true
  539. end
  540.  
  541.  
  542. if script.Parent.ClassName ~= "HopperBin" then
  543. if Player == nil then print("Error: Player not found!") return end
  544. Tool = Instance.new("HopperBin")
  545. Tool.Name = ModelName
  546. Tool.Parent = Player.Backpack
  547. script.Name = "Main"
  548. script.Parent = Tool
  549. elseif script.Parent.ClassName == "HopperBin" and Connected == false then
  550. Connected = true
  551. Player = script.Parent.Parent.Parent
  552. script.Parent.Selected:connect(onSelected)
  553. script.Parent.Deselected:connect(onDeselected)
  554. CreateParts(Player.Character, 1)
  555. coroutine.wrap(loadstring(FirstPerson))()
  556. coroutine.wrap(loadstring(MouseAim))()
  557. end
Advertisement
Add Comment
Please, Sign In to add comment