Hugo1234cool

Untitled

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