Advertisement
duplicat

Some Gun?

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