Advertisement
TheUnknownDiscord

shotgu

Oct 23rd, 2022 (edited)
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.43 KB | None | 0 0
  1. local blacklist = {}
  2. local shot = Instance.new("Sound")
  3. shot.SoundId = "rbxassetid://5773418559"
  4. shot.TimePosition = 0
  5. shot.Volume = 1
  6. local click = Instance.new("Sound")
  7. click.SoundId = "rbxassetid://134188543"
  8. click.TimePosition = 0.6
  9. click.PlayOnRemove = true
  10. click.Volume = 2
  11. e = Instance.new("RemoteEvent",owner.Character)
  12. local hed = Instance.new("Weld",owner.Character.Torso)
  13. hed.Part0 = owner.Character.Head
  14. hed.Part1 = hed.Parent
  15. hed.C0 = CFrame.new(0,-0.5,0)
  16. hed.C1 = CFrame.new(0,1,0)
  17. hed.Enabled = false
  18. local tool = Instance.new("Tool",owner.Backpack)
  19. tool.Grip = CFrame.new(0.2,-0.2,0.5) * CFrame.Angles(math.rad(-1),math.rad(-2),0)
  20. tool.Name = "shotgu"
  21. local armw = Instance.new("Weld",owner.Character.Torso)
  22. armw.Part0 = owner.Character["Right Arm"]
  23. armw.Part1 = owner.Character.Torso
  24. armw.C1 = CFrame.new(1.5,0.1,0.25)
  25. armw.Enabled = false
  26. armw.C0 = CFrame.new(0,0.5,0) * CFrame.Angles(math.rad(-90),0,0)
  27. local part = Instance.new("Part",tool)
  28. part.Name = "Handle"
  29. part.Size = Vector3.new(6.883,11.953,33.644) * 0.15
  30. local m = Instance.new("SpecialMesh",part)
  31. m.MeshId = "rbxassetid://10522415276"
  32. m.TextureId = "rbxassetid://10522448627"
  33. m.Scale = Vector3.new(1,1,1) * 0.084375
  34. local part2 = Instance.new("Part",tool)
  35. part2.CanCollide = false
  36. part2.Size = Vector3.new(6.883,11.953,33.644) * 0.15
  37. local m2 = Instance.new("SpecialMesh",part2)
  38. m2.MeshId = "rbxassetid://10522416072"
  39. m2.TextureId = "rbxassetid://10522448627"
  40. m2.Scale = Vector3.new(1,1,1) * 0.084375
  41. local part3 = Instance.new("Part",tool)
  42. part3.CanCollide = false
  43. part3.Size = Vector3.new(6.883,11.953,33.644) * 0.15
  44. local m3 = Instance.new("SpecialMesh",part3)
  45. m3.MeshId = "rbxassetid://10522415608"
  46. m3.TextureId = "rbxassetid://10522448627"
  47. m3.Scale = Vector3.new(1,1,1) * 0.084375
  48. local weld2 = Instance.new("Weld",part)
  49. weld2.Part0 = part3
  50. weld2.Part1 = part
  51. weld2.C1 = CFrame.new(0,0.675,0.1)
  52. local weld = Instance.new("Weld",part3)
  53. weld.Part0 = part2
  54. weld.Part1 = part3
  55. weld.C1 = CFrame.new(0,0.65,-1.75) * CFrame.new(0,-0.675,-0.1)
  56. local part4 = Instance.new("Part",tool)
  57. part4.CanCollide = false
  58. part4.Size = Vector3.new(6.883,11.953,33.644) * 0.15
  59. local m4 = Instance.new("SpecialMesh",part4)
  60. m4.MeshId = "rbxassetid://10522417111"
  61. m4.TextureId = "rbxassetid://10522448627"
  62. m4.Scale = Vector3.new(1,1,1) * 0.084375
  63. local weld3 = Instance.new("Weld",part3)
  64. weld3.Part0 = part4
  65. weld3.Part1 = part3
  66. weld3.C1 = CFrame.new(0,0.575,-1.9) * CFrame.new(0,-0.675,-0.1)
  67. local tweenService = game:GetService("TweenService")
  68. local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Back,Enum.EasingDirection.Out,0,false)
  69. local goal = {}
  70. goal.C0 = CFrame.new(0,-0.5,-0.7) * CFrame.Angles(math.rad(-115),0,0)
  71. local tween = tweenService:Create(armw, tweenInfo, goal)
  72. local tweenInfo = TweenInfo.new(0.25,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false)
  73. local goal2 = {}
  74. goal2.C0 = CFrame.new(0,0.1,-0.2) * CFrame.Angles(math.rad(-110),math.rad(-5),math.rad(-5))
  75. local tween2 = tweenService:Create(armw, tweenInfo, goal2)
  76. local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,true)
  77. local goal3 = {}
  78. goal3.C0 = CFrame.new(0,0,-1.2)
  79. local tween3 = tweenService:Create(weld3, tweenInfo, goal3)
  80. local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Back,Enum.EasingDirection.InOut,0,true)
  81. local goa = {}
  82. goa.C0 = CFrame.new(0,0,-0.3) * CFrame.Angles(math.rad(-109),math.rad(-4),math.rad(-4))
  83. local tweenn = tweenService:Create(armw, tweenInfo, goa)
  84. local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false)
  85. local goal4 = {}
  86. goal4.C0 = CFrame.new(0,0.5,0) * CFrame.Angles(math.rad(-90),0,0)
  87. local tween4 = tweenService:Create(armw, tweenInfo, goal4)
  88. local tweenInfo = TweenInfo.new(0.15,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true)
  89. local goa = {}
  90. goa.C0 = owner.Character.HumanoidRootPart:FindFirstChildWhichIsA("Motor6D").C0 * CFrame.Angles(math.rad(-5),0,0)
  91. local twee = tweenService:Create(owner.Character.HumanoidRootPart:FindFirstChildWhichIsA("Motor6D"), tweenInfo, goa)
  92. tween.Completed:Connect(function()
  93. tween2:Play()
  94. end)
  95. tween2.Completed:Connect(function()
  96. tween3:Play()
  97. tweenn:Play()
  98. end)
  99. tween3.Completed:Connect(function()
  100. tween4:Play()
  101. end)
  102. local db = false
  103. shot.Ended:Connect(function()
  104. shot.Parent = nil
  105. end)
  106. tween4.Completed:Connect(function()
  107. db = false
  108. end)
  109. tool.Activated:Connect(function()
  110. if not db then
  111. db = true
  112. tween:Play()
  113. twee:Play()
  114. shot.TimePosition = 0
  115. shot.Parent = part
  116. shot:Play()
  117. coroutine.wrap(function()
  118. local TimeToTake = 0.4
  119. local Accumulated = 0
  120. while TimeToTake > Accumulated do
  121. Accumulated += game:GetService("RunService").Heartbeat:Wait()
  122. end
  123. click.Parent = part
  124. click.Parent = nil
  125. end)()
  126. local look = {CFrame.Angles(owner.Character.Head.CFrame:ToEulerAnglesXYZ()) * CFrame.Angles(math.rad(-2),math.rad(-2),0);
  127. CFrame.Angles(owner.Character.Head.CFrame:ToEulerAnglesXYZ()) * CFrame.Angles(math.rad(-3),math.rad(0),0);
  128. CFrame.Angles(owner.Character.Head.CFrame:ToEulerAnglesXYZ()) * CFrame.Angles(math.rad(-2),math.rad(2),0);
  129. CFrame.Angles(owner.Character.Head.CFrame:ToEulerAnglesXYZ()) * CFrame.Angles(math.rad(0),math.rad(-3),0);
  130. CFrame.Angles(owner.Character.Head.CFrame:ToEulerAnglesXYZ());
  131. CFrame.Angles(owner.Character.Head.CFrame:ToEulerAnglesXYZ()) * CFrame.Angles(math.rad(0),math.rad(3),0);
  132. CFrame.Angles(owner.Character.Head.CFrame:ToEulerAnglesXYZ()) * CFrame.Angles(math.rad(2),math.rad(-2),0);
  133. CFrame.Angles(owner.Character.Head.CFrame:ToEulerAnglesXYZ()) * CFrame.Angles(math.rad(3),math.rad(0),0);
  134. CFrame.Angles(owner.Character.Head.CFrame:ToEulerAnglesXYZ()) * CFrame.Angles(math.rad(2),math.rad(2),0)}
  135. for i = 1, 9 do
  136. coroutine.wrap(function()
  137. look[i] = look[i] * CFrame.Angles(math.rad(math.random(-4,4)/5),math.rad(math.random(-4,4)/5),0)
  138. local shootybang
  139. local bullet = Instance.new("Part",script)
  140. bullet.Size = Vector3.new(0.25,0.25,10)
  141. bullet.CanCollide = false
  142. bullet.Anchored = true
  143. bullet.Color = Color3.fromRGB(200,200,200)
  144. bullet.Material = "Neon"
  145. table.insert(blacklist,bullet)
  146. local a1 = Instance.new("Attachment",bullet)
  147. a1.CFrame = CFrame.new(0,-0.1,10)
  148. local a2 = Instance.new("Attachment",bullet)
  149. a2.CFrame = CFrame.new(0,0.1,10)
  150. local t = Instance.new("Trail",bullet)
  151. t.Attachment0 = a1
  152. t.Attachment1 = a2
  153. t.Color = ColorSequence.new(bullet.Color)
  154. t.WidthScale = NumberSequence.new{NumberSequenceKeypoint.new(0,1),NumberSequenceKeypoint.new(1,0)}
  155. t.Lifetime = 0.1
  156. t.MaxLength = 10
  157. t.MinLength = 0.1
  158. t.LightEmission = 0.2
  159. t.LightInfluence = 0.5
  160. t.TextureLength = 1
  161. t.TextureMode = "Stretch"
  162. t.WidthScale = NumberSequence.new{NumberSequenceKeypoint.new(0, 1),NumberSequenceKeypoint.new(1, 0)}
  163. t.FaceCamera = true
  164. Instance.new("SpecialMesh",bullet).MeshType = "Sphere"
  165. bullet.CFrame = CFrame.new((part.CFrame * CFrame.new(0,0,2)).Position) * CFrame.Angles(part.CFrame:ToEulerAnglesXYZ())
  166. local params = RaycastParams.new()
  167. params.FilterDescendantsInstances = {script,bullet,owner.Character,blacklist}
  168. params.FilterType = Enum.RaycastFilterType.Blacklist
  169. local sped = 30
  170. local oghedcf = owner.Character.Head.CFrame
  171. local c = 0
  172. shootybang = game:GetService("RunService").Stepped:Connect(function(_,b)
  173. local res
  174. c = c + 1
  175. if c ~= 2 then
  176. res = workspace:Raycast(bullet.Position, bullet.CFrame.lookVector*((sped)*b*15), params)
  177. else
  178. bullet.CFrame = (CFrame.new(oghedcf.Position) * CFrame.Angles(look[i]:ToEulerAnglesXYZ())) * CFrame.new(0,0,(-sped + (15*b))*b*15)
  179. res = workspace:Raycast(bullet.Position, bullet.CFrame.lookVector*((sped)*b*15), params)
  180. end
  181. if not res then
  182. bullet.CFrame = bullet.CFrame * CFrame.new(0,0,(-sped)*b*15)
  183. sped = sped - (15*b)
  184. bullet.Size = Vector3.new(0.25,0.25,sped)
  185. a2.CFrame = CFrame.new(0,0.1,sped)
  186. a1.CFrame = CFrame.new(0,-0.1,sped)
  187. if sped < 0 then
  188. bullet:Destroy()
  189. shootybang:Disconnect()
  190. end
  191. else
  192. if res.Instance:FindFirstAncestorWhichIsA("Model") and res.Instance:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Humanoid") then
  193. res.Instance:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Humanoid").Health -= 45
  194. bullet:Destroy()
  195. shootybang:Disconnect()
  196. else
  197. bullet:Destroy()
  198. shootybang:Disconnect()
  199. end
  200. end
  201. end)
  202. end)()
  203. end
  204. end
  205. end)
  206. local equip = Instance.new("Sound")
  207. equip.PlayOnRemove = true
  208. equip.Volume = 1
  209. equip.SoundId = "rbxassetid://6870002623"
  210. tool.Equipped:Connect(function()
  211. equip.Parent = part
  212. equip.Parent = nil
  213. end)
  214. tool.Equipped:Connect(function()
  215. armw.Enabled = true
  216. hed.Enabled = true
  217. end)
  218. tool.Unequipped:Connect(function()
  219. armw.Enabled = false
  220. hed.Enabled = false
  221. end)
  222. e.OnServerEvent:Connect(function(_,cam,c1,alpha,hitcf,sw,wcs,shift)
  223. local lookvector = owner.Character.HumanoidRootPart.CFrame:toObjectSpace(cam).lookVector.unit
  224. hed.C0 = hed.C0:Lerp(CFrame.new(0,-0.5,0) * CFrame.Angles(-lookvector.y,0,0),0.5)
  225. hed.C0 = hed.C0 * CFrame.Angles(sw.y,0,0)
  226. if shift then
  227. if lookvector.y > 0 then
  228. armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.1,0) * CFrame.Angles(lookvector.y + sw.y,-(sw.x),0) * CFrame.new(0,-lookvector.y,-0.5 * lookvector.y),0.5)
  229. armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 2, wcs.x / 2,0),0.25)
  230. else
  231. armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.1,0) * CFrame.Angles(lookvector.y + sw.y,-(sw.x),0) * CFrame.new(0,0.5 * lookvector.y,-1.5 * lookvector.y),0.5)
  232. armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 2, wcs.x / 2,0),0.25)
  233. end
  234. else
  235. if lookvector.y > 0 then
  236. armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.1,0) * CFrame.Angles(lookvector.y + sw.y,0,0) * CFrame.new(0,-lookvector.y,-0.5 * lookvector.y),0.5)
  237. armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 2, wcs.x / 2,0),0.25)
  238. else
  239. armw.C1 = armw.C1:Lerp(CFrame.new(1.5,0.1,0) * CFrame.Angles(lookvector.y + sw.y,0,0) * CFrame.new(0,0.5 * lookvector.y,-1.5 * lookvector.y),0.5)
  240. armw.C1 = armw.C1:Lerp(armw.C1 * CFrame.new(wcs.y / 2, wcs.x / 2,0),0.25)
  241. end
  242. end
  243. end)
  244. NLS([[
  245. e = script.Parent
  246. local tool = owner.Backpack:WaitForChild("shotgu")
  247. eq = false
  248. tool.Equipped:Connect(function()
  249. eq = true
  250. end)
  251. tool.Unequipped:Connect(function()
  252. eq = false
  253. end)
  254. local ITERATIONS = 8
  255. local SPRING = {}
  256. function SPRING.create(self, mass, force, damping, speed)
  257. local spring = {
  258. Target = Vector3.new();
  259. Position = Vector3.new();
  260. Velocity = Vector3.new();
  261. Mass = mass or 5;
  262. Force = force or 50;
  263. Damping = damping or 4;
  264. Speed = speed or 4;
  265. }
  266. function spring.shove(self, force)
  267. local x, y, z = force.X, force.Y, force.Z
  268. if x ~= x or x == math.huge or x == -math.huge then
  269. x = 0
  270. end
  271. if y ~= y or y == math.huge or y == -math.huge then
  272. y = 0
  273. end
  274. if z ~= z or z == math.huge or z == -math.huge then
  275. z = 0
  276. end
  277. self.Velocity = self.Velocity + Vector3.new(x, y, z)
  278. end
  279. function spring.update(self, dt)
  280. local scaledDeltaTime = math.min(dt,1) * self.Speed / ITERATIONS
  281. for i = 1, ITERATIONS do
  282. local iterationForce = self.Target - self.Position
  283. local acceleration = (iterationForce * self.Force) / self.Mass
  284. acceleration = acceleration - (self.Velocity * self.Damping)
  285. self.Velocity = self.Velocity + (acceleration * scaledDeltaTime)
  286. self.Position = self.Position + (self.Velocity * scaledDeltaTime)
  287. end
  288. return self.Position
  289. end
  290. return spring
  291. end
  292. local wc = SPRING.create()
  293. local sway = SPRING.create()
  294. local bobspeed = 1
  295. local bobmod = .1
  296. local alpha = .25
  297. local hitcf = CFrame.new()
  298. local function gb(addition, speed, modifier)
  299. return math.sin(tick() * addition * speed) * modifier
  300. end
  301. c1 = CFrame.new(0,0,0)
  302. c2 = CFrame.new(0,0,0)
  303. local UIS = game:GetService("UserInputService")
  304. shift = false
  305. UIS:GetPropertyChangedSignal("MouseBehavior"):Connect(function()
  306. if UIS.MouseBehavior == Enum.MouseBehavior.LockCenter then
  307. shift = true
  308. elseif UIS.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
  309. shift = false
  310. end
  311. end)
  312. game:GetService("RunService").RenderStepped:Connect(function(dt)
  313. if eq then
  314. delta = game:GetService("UserInputService"):GetMouseDelta()
  315. local vel = owner.Character.HumanoidRootPart.Velocity
  316. local msway = Vector3.new(gb(10, bobspeed, bobmod), gb(5, bobspeed, bobmod), gb(5, bobspeed, bobmod))
  317. sway:shove(Vector3.new(delta.X / 500, delta.Y / 500))
  318. wc:shove((msway / 25) * dt * 60 * math.clamp(vel.Magnitude,0,30))
  319. local sw = sway:update(dt)
  320. local wcs = wc:update(dt)
  321. e:FireServer(workspace.CurrentCamera.CFrame,c1,alpha,hitcf,sw,wcs,shift)
  322. end
  323. end)
  324. ]],e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement