Prestige_E

Gun

Mar 13th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 10.65 KB | None | 0 0
  1. wait(1) --For running in rbx studio
  2. mee = game.Players.LocalPlayer
  3. pistol = Instance.new("Tool", mee.Backpack)
  4. pistol.GripForward = Vector3.new(-0.149, 0.984, -0.099)
  5. pistol.GripPos = Vector3.new(0.1, -0.55, -0.2)
  6. pistol.GripRight = Vector3.new(0.989, 0.148, -0.015)
  7. pistol.GripUp = Vector3.new(0, 0.1, 0.995)
  8. pistol.ToolTip = "Umm... where did you get that?"
  9. pistol.Name = "Pistol"
  10. pistolpart = Instance.new("Part", pistol)
  11. pistolpart.Name = "Handle"
  12. pistolpart.BrickColor = BrickColor.new("Black")
  13. pistolpart.Material = "SmoothPlastic"
  14. pistolpart.Orientation = Vector3.new(-88.99, 152.78, 135.7)
  15. pistolpart.Size = Vector3.new(0.2, 1.12, 0.6)
  16. pistolmesh = Instance.new("SpecialMesh", pistolpart)
  17. pistolmesh.MeshId = "rbxassetid://430060386"
  18. pistolmesh.Scale = Vector3.new(1.7, 1.7, 1.7)
  19. pistolmesh.TextureId = "rbxassetid://430060404"
  20. pistolmesh.VertexColor = Vector3.new(2, 2, 2)
  21. gunshotsound = Instance.new("Sound", pistolpart)
  22. gunshotsound.SoundId = "rbxassetid://213603013"
  23. mouserotatecharacter = true
  24.  
  25.  
  26. pistol.Equipped:connect(function(mouse)
  27. mouserotatecharacter = true
  28. local torso = mee.Character.HumanoidRootPart
  29. local mouseturning = mee:GetMouse()
  30. mee.Character.Humanoid.AutoRotate = false
  31. mouseturning.Move:connect(function()
  32. if mouserotatecharacter == true then
  33.   torso.CFrame = CFrame.new(torso.Position, mouseturning.Hit.p*Vector3.new(1,0,1) + torso.Position*Vector3.new(0, 1, 0))
  34.  
  35. end
  36. end)
  37. mouse.Button1Down:connect(function()
  38. gunshotsound:Play()
  39. MakeShell()
  40. local ray = Ray.new(pistol.Handle.CFrame.p, (mouse.Hit.p - pistol.Handle.CFrame.p).unit * 300)
  41. local part, position = workspace:FindPartOnRay(ray, mee.Character, false, true)
  42.  
  43. local beam = Instance.new("Part", workspace)
  44. beam.BrickColor = BrickColor.new("White")
  45. beam.FormFactor = "Custom"
  46. beam.Material = "Neon"
  47. beam.Transparency = 0.7
  48. beam.Anchored = true
  49. beam.Locked = true
  50. beam.CanCollide = false
  51.  
  52. local distance = (pistol.Handle.CFrame.p - position).magnitude
  53. beam.Size = Vector3.new(0.3, 0.3, distance)
  54. beam.CFrame = CFrame.new(pistol.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
  55.  
  56. game:GetService("Debris"):AddItem(beam, 0.1)
  57.  
  58. if part then
  59. local humanoid = part.Parent:FindFirstChild("Humanoid")
  60.  
  61. if not humanoid then
  62. humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
  63. end
  64.  
  65. if humanoid then
  66. plrmodel = humanoid.Parent
  67. if plrmodel.Humanoid.Health ~= 0 then
  68. --blood
  69. plrmodel.Archivable = true
  70. local Char = plrmodel
  71. local Hum = Char:FindFirstChild("Humanoid")
  72. local Tor = Char:FindFirstChild("Torso") or Char:FindFirstChild("UpperTorso")
  73. local Health = Hum.Health
  74.  
  75. local M = math.random
  76. local R = math.rad
  77. local rates = {.05, .075, .1, .15}
  78.  
  79. local smooth = function(P)
  80. local SM = Enum.SurfaceType.SmoothNoOutlines
  81. P.TopSurface = SM
  82. P.BottomSurface = SM
  83. P.RightSurface = SM
  84. P.LeftSurface = SM
  85. P.FrontSurface = SM
  86. P.BackSurface = SM
  87. end
  88.  
  89. local function BloodPool(Part,Size)
  90. local Pool = Instance.new("Part",game.Workspace)
  91. Pool.TopSurface = 0
  92. Pool.CanCollide = false
  93. Pool.BrickColor = BrickColor.new("Crimson")
  94. Pool.Transparency = 0
  95. Instance.new("CylinderMesh",Pool)
  96. Pool.Anchored = true
  97. Pool.Name = "BloodPoolPart"
  98. smooth(Pool)
  99. Pool.FormFactor = Enum.FormFactor.Custom
  100. Pool.Size = Size
  101. local c = Part.CFrame*CFrame.new(M(-3.01,3.01),-2.9,M(-3.01,3.01))
  102. coroutine.resume(coroutine.create(function()
  103. local rate = rates[M(1,#rates)]
  104. game.Debris:AddItem(Pool,15)
  105. for i = 1,M(25,70) do
  106. wait()
  107. Pool.CFrame = c
  108. Pool.Size = Pool.Size+Vector3.new(rate,0,rate)
  109. end
  110. wait(5)
  111. Pool:Destroy()
  112. end))
  113. end
  114.  
  115. local function BloodDrops(Size,Area)
  116. local Blood = Instance.new("Part",game.Workspace)
  117. Blood.BrickColor = BrickColor.new("Crimson")
  118. Blood.Parent = plrmodel
  119. Blood.TopSurface = 0
  120. Blood.CanCollide = false
  121. Blood.Anchored = false
  122. Blood.FormFactor = Enum.FormFactor.Custom
  123. Blood.Size = Size
  124. Blood.CFrame = Area*CFrame.new(M(-1.00,1.00),M(-1.00,1.00),M(-1.00,1.00))
  125. return Blood
  126. end
  127.  
  128.  
  129.  
  130. Hum.Changed:connect(function()
  131. if Hum.Health < Health then
  132.  
  133. Health = Hum.Health
  134. for i = 1, math.random(4,10)do
  135. local Size = Vector3.new(M(-0.25,0.25),.2,M(-.25,.25))
  136. local Blood = BloodDrops(Size,Tor.CFrame)
  137. local Stopper = false
  138. local Size2 = Vector3.new(M(-0.25,0.25),.2,M(-.25,.25))
  139. BloodPool(Tor,Size2)
  140. end
  141. end
  142. end)
  143. end
  144. --Ragdoll
  145. wait()
  146. function getAttachment0(attachmentName)
  147. for _,child in next,plrmodel:GetChildren() do
  148. local attachment = child:FindFirstChild(attachmentName)
  149. if attachment then
  150. return attachment
  151. end
  152. end
  153. end
  154. plrmodel.Humanoid.Died:Connect(function(var)
  155. local removeHRP = true
  156. local head = plrmodel["Head"]
  157. local leftarm = plrmodel["Left Arm"]
  158. local leftleg = plrmodel["Left Leg"]
  159. local rightleg = plrmodel["Right Leg"]
  160. local rightarm = plrmodel["Right Arm"]
  161. local torso = plrmodel.Torso
  162. local root = plrmodel.HumanoidRootPart
  163. if removeHRP == true then
  164. root:Destroy()
  165. end
  166. local rootA =Instance.new("Attachment")
  167. local HeadA = Instance.new("Attachment")
  168. local LeftArmA = Instance.new("Attachment")
  169. local LeftLegA = Instance.new("Attachment")
  170. local RightArmA = Instance.new("Attachment")
  171. local RightLegA = Instance.new("Attachment")
  172. local TorsoA = Instance.new("Attachment")
  173. local TorsoA1 = Instance.new("Attachment")
  174. local TorsoA2 = Instance.new("Attachment")
  175. local TorsoA3 = Instance.new("Attachment")
  176. local TorsoA4 = Instance.new("Attachment")
  177. local TorsoA5 = Instance.new("Attachment")
  178. local function set1()
  179. HeadA.Name = "HeadA"
  180. HeadA.Parent = head
  181. HeadA.Position = Vector3.new(0, -0.5, 0)
  182. HeadA.Rotation = Vector3.new(0, 0, 0)
  183. HeadA.Axis = Vector3.new(1, 0, 0)
  184. HeadA.SecondaryAxis = Vector3.new(0, 1, 0)
  185. LeftArmA.Name = "LeftArmA"
  186. LeftArmA.Parent = leftarm
  187. LeftArmA.Position = Vector3.new(0.5, 1, 0)
  188. LeftArmA.Rotation = Vector3.new(0, 0, 0)
  189. LeftArmA.Axis = Vector3.new(1, 0, 0)
  190. LeftArmA.SecondaryAxis = Vector3.new(0, 1, 0)
  191. LeftLegA.Name = "LeftLegA"
  192. LeftLegA.Parent = leftleg
  193. LeftLegA.Position = Vector3.new(0, 1, 0)
  194. LeftLegA.Rotation = Vector3.new(0, 0, 0)
  195. LeftLegA.Axis = Vector3.new(1, 0, 0)
  196. LeftLegA.SecondaryAxis = Vector3.new(0, 1, 0)
  197. RightArmA.Name = "RightArmA"
  198. RightArmA.Parent = rightarm
  199. RightArmA.Position = Vector3.new(-0.5, 1, 0)
  200. RightArmA.Rotation = Vector3.new(0, 0, 0)
  201. RightArmA.Axis = Vector3.new(1, 0, 0)
  202. RightArmA.SecondaryAxis = Vector3.new(0, 1, 0)
  203. RightLegA.Name = "RightLegA"
  204. RightLegA.Parent = rightleg
  205. RightLegA.Position = Vector3.new(0, 1, 0)
  206. RightLegA.Rotation = Vector3.new(0, 0, 0)
  207. RightLegA.Axis = Vector3.new(1, 0, 0)
  208. RightLegA.SecondaryAxis = Vector3.new(0, 1, 0)
  209. rootA.Name= "rootA"
  210. rootA.Parent = root
  211. rootA.Position = Vector3.new(0, 0, 0)
  212. rootA.Rotation = Vector3.new(0, 90, 0)
  213. rootA.Axis = Vector3.new(0, 0, -1)
  214. rootA.SecondaryAxis = Vector3.new(0, 1, 0)
  215. end
  216. local function set2()
  217. TorsoA.Name = "TorsoA"
  218. TorsoA.Parent = torso
  219. TorsoA.Position = Vector3.new(0.5, -1, 0)
  220. TorsoA.Rotation = Vector3.new(0, 0, 0)
  221. TorsoA.Axis = Vector3.new(1, 0, 0)
  222. TorsoA.SecondaryAxis = Vector3.new(0, 1, 0)
  223. TorsoA1.Name = "TorsoA1"
  224. TorsoA1.Parent = torso
  225. TorsoA1.Position = Vector3.new(-0.5, -1, 0)
  226. TorsoA1.Rotation = Vector3.new(0, 0, 0)
  227. TorsoA1.Axis = Vector3.new(1, 0, 0)
  228. TorsoA1.SecondaryAxis = Vector3.new(0, 1, 0)
  229. TorsoA2.Name = "TorsoA2"
  230. TorsoA2.Parent = torso
  231. TorsoA2.Position = Vector3.new(-1, 1, 0)
  232. TorsoA2.Rotation = Vector3.new(0, 0, 0)
  233. TorsoA2.Axis = Vector3.new(1, 0, 0)
  234. TorsoA2.SecondaryAxis = Vector3.new(0, 1, 0)
  235. TorsoA3.Name = "TorsoA3"
  236. TorsoA3.Parent = torso
  237. TorsoA3.Position = Vector3.new(1, 1, 0)
  238. TorsoA3.Rotation = Vector3.new(0, 0, 0)
  239. TorsoA3.Axis = Vector3.new(1, 0, 0)
  240. TorsoA3.SecondaryAxis = Vector3.new(0, 1, 0)
  241. TorsoA4.Name = "TorsoA4"
  242. TorsoA4.Parent = torso
  243. TorsoA4.Position = Vector3.new(0, 1, 0)
  244. TorsoA4.Rotation = Vector3.new(0, 0, 0)
  245. TorsoA4.Axis = Vector3.new(1, 0, 0)
  246. TorsoA4.SecondaryAxis = Vector3.new(0, 1, 0)
  247. TorsoA5.Name = "TorsoA5"
  248. TorsoA5.Parent = torso
  249. TorsoA5.Position = Vector3.new(0, 0, 0)
  250. TorsoA5.Rotation = Vector3.new(0, 90, 0)
  251. TorsoA5.Axis = Vector3.new(0, 0, -1)
  252. TorsoA5.SecondaryAxis = Vector3.new(0, 1, 0)
  253. end
  254. local function set3()
  255. end
  256. spawn(set1);
  257. spawn(set2);
  258. local HA = Instance.new("HingeConstraint")
  259. HA.Parent = head
  260. HA.Attachment0 = HeadA
  261. HA.Attachment1 = TorsoA4
  262. HA.Enabled = true
  263. HA.LimitsEnabled=true
  264. HA.LowerAngle=0
  265. HA.UpperAngle=0
  266. local LAT = Instance.new("BallSocketConstraint")
  267. LAT.Parent = leftarm
  268. LAT.Attachment0 = LeftArmA
  269. LAT.Attachment1 = TorsoA2
  270. LAT.Enabled = true
  271. LAT.LimitsEnabled=true
  272. LAT.UpperAngle=90
  273. local RAT = Instance.new("BallSocketConstraint")
  274. RAT.Parent = rightarm
  275. RAT.Attachment0 = RightArmA
  276. RAT.Attachment1 = TorsoA3
  277. RAT.Enabled = true
  278. RAT.LimitsEnabled=true
  279. RAT.UpperAngle=90
  280. local HA = Instance.new("BallSocketConstraint")
  281. HA.Parent = head
  282. HA.Attachment0 = HeadA
  283. HA.Attachment1 = TorsoA4
  284. HA.Enabled = true
  285. local TLL = Instance.new("BallSocketConstraint")
  286. TLL.Parent = torso
  287. TLL.Attachment0 = TorsoA1
  288. TLL.Attachment1 = LeftLegA
  289. TLL.Enabled = true
  290. TLL.LimitsEnabled=true
  291. TLL.UpperAngle=90
  292. local TRL = Instance.new("BallSocketConstraint")
  293. TRL.Parent = torso
  294. TRL.Attachment0 = TorsoA
  295. TRL.Attachment1 = RightLegA
  296. TRL.Enabled = true
  297. TRL.LimitsEnabled=true
  298. TRL.UpperAngle=90
  299. local RTA = Instance.new("BallSocketConstraint")
  300. RTA.Parent = root
  301. RTA.Attachment0 = rootA
  302. RTA.Attachment1 = TorsoA5
  303. RTA.Enabled = true
  304. RTA.LimitsEnabled=true
  305. RTA.UpperAngle=0
  306. head.Velocity = head.CFrame.lookVector*30
  307.  
  308. for _,child in next,plrmodel:GetChildren() do
  309. if child:IsA("Accoutrement") then
  310. for _,part in next,child:GetChildren() do
  311. if part:IsA("BasePart") then
  312. part.Parent = plrmodel
  313. child:remove()
  314. local attachment1 = part:FindFirstChildOfClass("Attachment")
  315. local attachment0 = getAttachment0(attachment1.Name)
  316. if attachment0 and attachment1 then
  317. local constraint = Instance.new("HingeConstraint")
  318. constraint.Attachment0 = attachment0
  319. constraint.Attachment1 = attachment1
  320. constraint.LimitsEnabled = true
  321. constraint.UpperAngle = 0
  322. constraint.LowerAngle = 0
  323. constraint.Parent = plrmodel
  324. end
  325. end
  326. end
  327. end
  328. end
  329. end)
  330.  
  331. end
  332. if humanoid.Health ~= 0 then
  333. humanoid.Health = 0
  334. wait(3)
  335. while true do
  336. if humanoid.Health ~= 0 then
  337. humanoid.Health = 0 --This loop is a strange kill system I know, but this prevents doing 99 damage instead of 100 for some reason.s
  338. else
  339. break
  340. end
  341. wait(0.3)
  342. end
  343. end
  344. end
  345. end)
  346. end)
  347.  
  348. pistol.Unequipped:connect(function()
  349. wait(0.2)
  350. mouserotatecharacter = false
  351.  mee.Character.Humanoid.AutoRotate = true
  352. end)
  353. function MakeShell()
  354. Shell = Instance.new("Part", workspace)
  355. Shell.Size = Vector3.new(0.2, 0.2, 0.6)
  356. ShellMesh = Instance.new("SpecialMesh", Shell)
  357. ShellMesh.MeshId = "http://www.roblox.com/asset/?id=94295100"
  358. ShellMesh.Scale = Vector3.new(4, 4, 4)
  359. ShellMesh.TextureId = "http://www.roblox.com/asset/?id=94287792"
  360. Shell.Position = pistolpart.Position
  361. end
Add Comment
Please, Sign In to add comment