RO_scripter

G U N

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