Advertisement
bmrx13

pistolero

Sep 28th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.29 KB | None | 0 0
  1.  
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code by Mokiros")
  7. local rp = RealPlayer
  8. script.Parent = rp.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent then
  34. for _,f in pairs(t.Functions) do
  35. f(...)
  36. end
  37. end
  38. end
  39. m.TrigEvent = te
  40. UIS.TrigEvent = te
  41.  
  42. Event.OnServerEvent:Connect(function(plr,io)
  43. if plr~=rp then return end
  44. m.Target = io.Target
  45. m.Hit = io.Hit
  46. if not io.isMouse then
  47. local b = io.UserInputState == Enum.UserInputState.Begin
  48. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  49. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  50. end
  51. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  52. return m:TrigEvent(b and "Button2Down" or "Button2Up")
  53. end
  54. for _,t in pairs(CAS.Actions) do
  55. for _,k in pairs(t.Keys) do
  56. if k==io.KeyCode then
  57. t.Function(t.Name,io.UserInputState,io)
  58. end
  59. end
  60. end
  61. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  62. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  63. end
  64. end)
  65. Event.Parent = NLS([==[
  66. local Player = game:GetService("Players").LocalPlayer
  67. local Event = script:WaitForChild("UserInput_Event")
  68.  
  69. local Mouse = Player:GetMouse()
  70. local UIS = game:GetService("UserInputService")
  71. local input = function(io,a)
  72. if a then return end
  73. --Since InputObject is a client-side instance, we create and pass table instead
  74. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  75. end
  76. UIS.InputBegan:Connect(input)
  77. UIS.InputEnded:Connect(input)
  78.  
  79. local h,t
  80. --Give the server mouse data 30 times every second, but only if the values changed
  81. --If player is not moving their mouse, client won't fire events
  82. while wait(1/30) do
  83. if h~=Mouse.Hit or t~=Mouse.Target then
  84. h,t=Mouse.Hit,Mouse.Target
  85. Event:FireServer({isMouse=true,Target=t,Hit=h})
  86. end
  87. end]==],Player.Character)
  88.  
  89. ----Sandboxed game object that allows the usage of client-side methods and services
  90. --Real game object
  91. local _rg = game
  92.  
  93. --Metatable for fake service
  94. local fsmt = {
  95. __index = function(self,k)
  96. local s = rawget(self,"_RealService")
  97. if s then
  98. return typeof(s[k])=="function"
  99. and function(_,...)return s[k](s,...)end or s[k]
  100. end
  101. end,
  102. __newindex = function(self,k,v)
  103. local s = rawget(self,"_RealService")
  104. if s then s[k]=v end
  105. end
  106. }
  107. local function FakeService(t,RealService)
  108. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  109. return setmetatable(t,fsmt)
  110. end
  111.  
  112. --Fake game object
  113. local g = {
  114. GetService = function(self,s)
  115. return rawget(self,s) or _rg:GetService(s)
  116. end,
  117. Players = FakeService({
  118. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  119. },"Players"),
  120. UserInputService = FakeService(UIS,"UserInputService"),
  121. ContextActionService = FakeService(CAS,"ContextActionService"),
  122. RunService = FakeService({
  123. _btrs = {},
  124. RenderStepped = _rg:GetService("RunService").Heartbeat,
  125. BindToRenderStep = function(self,name,_,fun)
  126. self._btrs[name] = self.Heartbeat:Connect(fun)
  127. end,
  128. UnbindFromRenderStep = function(self,name)
  129. self._btrs[name]:Disconnect()
  130. end,
  131. },"RunService")
  132. }
  133. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  134. g.service = g.GetService
  135. FakeService(g,game)
  136. --Changing owner to fake player object to support owner:GetMouse()
  137. game,owner = g,g.Players.LocalPlayer
  138. end
  139. wait(1) --For running in rbx studio
  140. mee = game.Players.LocalPlayer
  141. pistol = Instance.new("Tool", mee.Backpack)
  142. pistol.GripForward = Vector3.new(-0.149, 0.984, -0.099)
  143. pistol.GripPos = Vector3.new(0.1, -0.55, -0.2)
  144. pistol.GripRight = Vector3.new(0.989, 0.148, -0.015)
  145. pistol.GripUp = Vector3.new(0, 0.1, 0.995)
  146. pistol.ToolTip = "Umm... where did you get that?"
  147. pistol.Name = "Pistol"
  148. pistolpart = Instance.new("Part", pistol)
  149. pistolpart.Name = "Handle"
  150. pistolpart.BrickColor = BrickColor.new("Black")
  151. pistolpart.Material = "SmoothPlastic"
  152. pistolpart.Orientation = Vector3.new(-88.99, 152.78, 135.7)
  153. pistolpart.Size = Vector3.new(0.2, 1.12, 0.6)
  154. pistolmesh = Instance.new("SpecialMesh", pistolpart)
  155. pistolmesh.MeshId = "rbxassetid://430060386"
  156. pistolmesh.Scale = Vector3.new(1.7, 1.7, 1.7)
  157. pistolmesh.TextureId = "rbxassetid://430060404"
  158. pistolmesh.VertexColor = Vector3.new(2, 2, 2)
  159. gunshotsound = Instance.new("Sound", pistolpart)
  160. gunshotsound.SoundId = "rbxassetid://213603013"
  161. mouserotatecharacter = true
  162.  
  163.  
  164. pistol.Equipped:connect(function(mouse)
  165. mouserotatecharacter = true
  166. local torso = mee.Character.HumanoidRootPart
  167. local mouseturning = mee:GetMouse()
  168. mee.Character.Humanoid.AutoRotate = false
  169. mouseturning.Move:connect(function()
  170. if mouserotatecharacter == true then
  171. torso.CFrame = CFrame.new(torso.Position, mouseturning.Hit.p*Vector3.new(1,0,1) + torso.Position*Vector3.new(0, 1, 0))
  172.  
  173. end
  174. end)
  175. mouse.Button1Down:connect(function()
  176. gunshotsound:Play()
  177. MakeShell()
  178. local ray = Ray.new(pistol.Handle.CFrame.p, (mouse.Hit.p - pistol.Handle.CFrame.p).unit * 300)
  179. local part, position = workspace:FindPartOnRay(ray, mee.Character, false, true)
  180.  
  181. local beam = Instance.new("Part", workspace)
  182. beam.BrickColor = BrickColor.new("White")
  183. beam.FormFactor = "Custom"
  184. beam.Material = "Neon"
  185. beam.Transparency = 0.7
  186. beam.Anchored = true
  187. beam.Locked = true
  188. beam.CanCollide = false
  189.  
  190. local distance = (pistol.Handle.CFrame.p - position).magnitude
  191. beam.Size = Vector3.new(0.3, 0.3, distance)
  192. beam.CFrame = CFrame.new(pistol.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
  193.  
  194. game:GetService("Debris"):AddItem(beam, 0.1)
  195.  
  196. if part then
  197. local humanoid = part.Parent:FindFirstChild("Humanoid")
  198.  
  199. if not humanoid then
  200. humanoid = part.Parent.Parent:FindFirstChild("Humanoid")
  201. end
  202.  
  203. if humanoid then
  204. plrmodel = humanoid.Parent
  205. if plrmodel.Humanoid.Health ~= 0 then
  206. --blood
  207. plrmodel.Archivable = true
  208. local Char = plrmodel
  209. local Hum = Char:FindFirstChild("Humanoid")
  210. local Tor = Char:FindFirstChild("Torso") or Char:FindFirstChild("UpperTorso")
  211. local Health = Hum.Health
  212.  
  213. local M = math.random
  214. local R = math.rad
  215. local rates = {.05, .075, .1, .15}
  216.  
  217. local smooth = function(P)
  218. local SM = Enum.SurfaceType.SmoothNoOutlines
  219. P.TopSurface = SM
  220. P.BottomSurface = SM
  221. P.RightSurface = SM
  222. P.LeftSurface = SM
  223. P.FrontSurface = SM
  224. P.BackSurface = SM
  225. end
  226.  
  227. local function BloodPool(Part,Size)
  228. local Pool = Instance.new("Part",game.Workspace)
  229. Pool.TopSurface = 0
  230. Pool.CanCollide = false
  231. Pool.BrickColor = BrickColor.new("Crimson")
  232. Pool.Transparency = 0
  233. Instance.new("CylinderMesh",Pool)
  234. Pool.Anchored = true
  235. Pool.Name = "BloodPoolPart"
  236. smooth(Pool)
  237. Pool.FormFactor = Enum.FormFactor.Custom
  238. Pool.Size = Size
  239. local c = Part.CFrame*CFrame.new(M(-3.01,3.01),-2.9,M(-3.01,3.01))
  240. coroutine.resume(coroutine.create(function()
  241. local rate = rates[M(1,#rates)]
  242. game.Debris:AddItem(Pool,15)
  243. for i = 1,M(25,70) do
  244. wait()
  245. Pool.CFrame = c
  246. Pool.Size = Pool.Size+Vector3.new(rate,0,rate)
  247. end
  248. wait(5)
  249. Pool:Destroy()
  250. end))
  251. end
  252.  
  253. local function BloodDrops(Size,Area)
  254. local Blood = Instance.new("Part",game.Workspace)
  255. Blood.BrickColor = BrickColor.new("Crimson")
  256. Blood.Parent = plrmodel
  257. Blood.TopSurface = 0
  258. Blood.CanCollide = false
  259. Blood.Anchored = false
  260. Blood.FormFactor = Enum.FormFactor.Custom
  261. Blood.Size = Size
  262. Blood.CFrame = Area*CFrame.new(M(-1.00,1.00),M(-1.00,1.00),M(-1.00,1.00))
  263. return Blood
  264. end
  265.  
  266.  
  267.  
  268. Hum.Changed:connect(function()
  269. if Hum.Health < Health then
  270.  
  271. Health = Hum.Health
  272. for i = 1, math.random(4,10)do
  273. local Size = Vector3.new(M(-0.25,0.25),.2,M(-.25,.25))
  274. local Blood = BloodDrops(Size,Tor.CFrame)
  275. local Stopper = false
  276. local Size2 = Vector3.new(M(-0.25,0.25),.2,M(-.25,.25))
  277. BloodPool(Tor,Size2)
  278. end
  279. end
  280. end)
  281. end
  282. --Ragdoll
  283. wait()
  284. function getAttachment0(attachmentName)
  285. for _,child in next,plrmodel:GetChildren() do
  286. local attachment = child:FindFirstChild(attachmentName)
  287. if attachment then
  288. return attachment
  289. end
  290. end
  291. end
  292. plrmodel.Humanoid.Died:Connect(function(var)
  293. local removeHRP = true
  294. local head = plrmodel["Head"]
  295. local leftarm = plrmodel["Left Arm"]
  296. local leftleg = plrmodel["Left Leg"]
  297. local rightleg = plrmodel["Right Leg"]
  298. local rightarm = plrmodel["Right Arm"]
  299. local torso = plrmodel.Torso
  300. local root = plrmodel.HumanoidRootPart
  301. if removeHRP == true then
  302. root:Destroy()
  303. end
  304. local rootA =Instance.new("Attachment")
  305. local HeadA = Instance.new("Attachment")
  306. local LeftArmA = Instance.new("Attachment")
  307. local LeftLegA = Instance.new("Attachment")
  308. local RightArmA = Instance.new("Attachment")
  309. local RightLegA = Instance.new("Attachment")
  310. local TorsoA = Instance.new("Attachment")
  311. local TorsoA1 = Instance.new("Attachment")
  312. local TorsoA2 = Instance.new("Attachment")
  313. local TorsoA3 = Instance.new("Attachment")
  314. local TorsoA4 = Instance.new("Attachment")
  315. local TorsoA5 = Instance.new("Attachment")
  316. local function set1()
  317. HeadA.Name = "HeadA"
  318. HeadA.Parent = head
  319. HeadA.Position = Vector3.new(0, -0.5, 0)
  320. HeadA.Rotation = Vector3.new(0, 0, 0)
  321. HeadA.Axis = Vector3.new(1, 0, 0)
  322. HeadA.SecondaryAxis = Vector3.new(0, 1, 0)
  323. LeftArmA.Name = "LeftArmA"
  324. LeftArmA.Parent = leftarm
  325. LeftArmA.Position = Vector3.new(0.5, 1, 0)
  326. LeftArmA.Rotation = Vector3.new(0, 0, 0)
  327. LeftArmA.Axis = Vector3.new(1, 0, 0)
  328. LeftArmA.SecondaryAxis = Vector3.new(0, 1, 0)
  329. LeftLegA.Name = "LeftLegA"
  330. LeftLegA.Parent = leftleg
  331. LeftLegA.Position = Vector3.new(0, 1, 0)
  332. LeftLegA.Rotation = Vector3.new(0, 0, 0)
  333. LeftLegA.Axis = Vector3.new(1, 0, 0)
  334. LeftLegA.SecondaryAxis = Vector3.new(0, 1, 0)
  335. RightArmA.Name = "RightArmA"
  336. RightArmA.Parent = rightarm
  337. RightArmA.Position = Vector3.new(-0.5, 1, 0)
  338. RightArmA.Rotation = Vector3.new(0, 0, 0)
  339. RightArmA.Axis = Vector3.new(1, 0, 0)
  340. RightArmA.SecondaryAxis = Vector3.new(0, 1, 0)
  341. RightLegA.Name = "RightLegA"
  342. RightLegA.Parent = rightleg
  343. RightLegA.Position = Vector3.new(0, 1, 0)
  344. RightLegA.Rotation = Vector3.new(0, 0, 0)
  345. RightLegA.Axis = Vector3.new(1, 0, 0)
  346. RightLegA.SecondaryAxis = Vector3.new(0, 1, 0)
  347. rootA.Name= "rootA"
  348. rootA.Parent = root
  349. rootA.Position = Vector3.new(0, 0, 0)
  350. rootA.Rotation = Vector3.new(0, 90, 0)
  351. rootA.Axis = Vector3.new(0, 0, -1)
  352. rootA.SecondaryAxis = Vector3.new(0, 1, 0)
  353. end
  354. local function set2()
  355. TorsoA.Name = "TorsoA"
  356. TorsoA.Parent = torso
  357. TorsoA.Position = Vector3.new(0.5, -1, 0)
  358. TorsoA.Rotation = Vector3.new(0, 0, 0)
  359. TorsoA.Axis = Vector3.new(1, 0, 0)
  360. TorsoA.SecondaryAxis = Vector3.new(0, 1, 0)
  361. TorsoA1.Name = "TorsoA1"
  362. TorsoA1.Parent = torso
  363. TorsoA1.Position = Vector3.new(-0.5, -1, 0)
  364. TorsoA1.Rotation = Vector3.new(0, 0, 0)
  365. TorsoA1.Axis = Vector3.new(1, 0, 0)
  366. TorsoA1.SecondaryAxis = Vector3.new(0, 1, 0)
  367. TorsoA2.Name = "TorsoA2"
  368. TorsoA2.Parent = torso
  369. TorsoA2.Position = Vector3.new(-1, 1, 0)
  370. TorsoA2.Rotation = Vector3.new(0, 0, 0)
  371. TorsoA2.Axis = Vector3.new(1, 0, 0)
  372. TorsoA2.SecondaryAxis = Vector3.new(0, 1, 0)
  373. TorsoA3.Name = "TorsoA3"
  374. TorsoA3.Parent = torso
  375. TorsoA3.Position = Vector3.new(1, 1, 0)
  376. TorsoA3.Rotation = Vector3.new(0, 0, 0)
  377. TorsoA3.Axis = Vector3.new(1, 0, 0)
  378. TorsoA3.SecondaryAxis = Vector3.new(0, 1, 0)
  379. TorsoA4.Name = "TorsoA4"
  380. TorsoA4.Parent = torso
  381. TorsoA4.Position = Vector3.new(0, 1, 0)
  382. TorsoA4.Rotation = Vector3.new(0, 0, 0)
  383. TorsoA4.Axis = Vector3.new(1, 0, 0)
  384. TorsoA4.SecondaryAxis = Vector3.new(0, 1, 0)
  385. TorsoA5.Name = "TorsoA5"
  386. TorsoA5.Parent = torso
  387. TorsoA5.Position = Vector3.new(0, 0, 0)
  388. TorsoA5.Rotation = Vector3.new(0, 90, 0)
  389. TorsoA5.Axis = Vector3.new(0, 0, -1)
  390. TorsoA5.SecondaryAxis = Vector3.new(0, 1, 0)
  391. end
  392. local function set3()
  393. end
  394. spawn(set1);
  395. spawn(set2);
  396. local HA = Instance.new("HingeConstraint")
  397. HA.Parent = head
  398. HA.Attachment0 = HeadA
  399. HA.Attachment1 = TorsoA4
  400. HA.Enabled = true
  401. HA.LimitsEnabled=true
  402. HA.LowerAngle=0
  403. HA.UpperAngle=0
  404. local LAT = Instance.new("BallSocketConstraint")
  405. LAT.Parent = leftarm
  406. LAT.Attachment0 = LeftArmA
  407. LAT.Attachment1 = TorsoA2
  408. LAT.Enabled = true
  409. LAT.LimitsEnabled=true
  410. LAT.UpperAngle=90
  411. local RAT = Instance.new("BallSocketConstraint")
  412. RAT.Parent = rightarm
  413. RAT.Attachment0 = RightArmA
  414. RAT.Attachment1 = TorsoA3
  415. RAT.Enabled = true
  416. RAT.LimitsEnabled=true
  417. RAT.UpperAngle=90
  418. local HA = Instance.new("BallSocketConstraint")
  419. HA.Parent = head
  420. HA.Attachment0 = HeadA
  421. HA.Attachment1 = TorsoA4
  422. HA.Enabled = true
  423. local TLL = Instance.new("BallSocketConstraint")
  424. TLL.Parent = torso
  425. TLL.Attachment0 = TorsoA1
  426. TLL.Attachment1 = LeftLegA
  427. TLL.Enabled = true
  428. TLL.LimitsEnabled=true
  429. TLL.UpperAngle=90
  430. local TRL = Instance.new("BallSocketConstraint")
  431. TRL.Parent = torso
  432. TRL.Attachment0 = TorsoA
  433. TRL.Attachment1 = RightLegA
  434. TRL.Enabled = true
  435. TRL.LimitsEnabled=true
  436. TRL.UpperAngle=90
  437. local RTA = Instance.new("BallSocketConstraint")
  438. RTA.Parent = root
  439. RTA.Attachment0 = rootA
  440. RTA.Attachment1 = TorsoA5
  441. RTA.Enabled = true
  442. RTA.LimitsEnabled=true
  443. RTA.UpperAngle=0
  444. head.Velocity = head.CFrame.lookVector*30
  445.  
  446. for _,child in next,plrmodel:GetChildren() do
  447. if child:IsA("Accoutrement") then
  448. for _,part in next,child:GetChildren() do
  449. if part:IsA("BasePart") then
  450. part.Parent = plrmodel
  451. child:remove()
  452. local attachment1 = part:FindFirstChildOfClass("Attachment")
  453. local attachment0 = getAttachment0(attachment1.Name)
  454. if attachment0 and attachment1 then
  455. local constraint = Instance.new("HingeConstraint")
  456. constraint.Attachment0 = attachment0
  457. constraint.Attachment1 = attachment1
  458. constraint.LimitsEnabled = true
  459. constraint.UpperAngle = 0
  460. constraint.LowerAngle = 0
  461. constraint.Parent = plrmodel
  462. end
  463. end
  464. end
  465. end
  466. end
  467. end)
  468.  
  469. end
  470. if humanoid.Health ~= 0 then
  471. humanoid.Health = 0
  472. wait(3)
  473. while true do
  474. if humanoid.Health ~= 0 then
  475. 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
  476. else
  477. break
  478. end
  479. wait(0.3)
  480. end
  481. end
  482. end
  483. end)
  484. end)
  485.  
  486. pistol.Unequipped:connect(function()
  487. wait(0.2)
  488. mouserotatecharacter = false
  489. mee.Character.Humanoid.AutoRotate = true
  490. end)
  491. function MakeShell()
  492. Shell = Instance.new("Part", workspace)
  493. Shell.Size = Vector3.new(0.2, 0.2, 0.6)
  494. ShellMesh = Instance.new("SpecialMesh", Shell)
  495. ShellMesh.MeshId = "http://www.roblox.com/asset/?id=94295100"
  496. ShellMesh.Scale = Vector3.new(4, 4, 4)
  497. ShellMesh.TextureId = "http://www.roblox.com/asset/?id=94287792"
  498. Shell.Position = pistolpart.Position
  499. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement