benli45

Untitled

Dec 20th, 2018
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.23 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  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,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.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,Connect=function(self,f)self.Function=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()}
  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 and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87. --Converted with ttyyuu12345's model to script plugin v4
  88. function sandbox(var,func)
  89. local env = getfenv(func)
  90. local newenv = setmetatable({},{
  91. __index = function(self,k)
  92. if k=="script" then
  93. return var
  94. else
  95. return env[k]
  96. end
  97. end,
  98. })
  99. setfenv(func,newenv)
  100. return func
  101. end
  102. cors = {}
  103. mas = Instance.new("Model",game:GetService("Lighting"))
  104. Tool0 = Instance.new("Tool")
  105. Part1 = Instance.new("Part")
  106. SpecialMesh2 = Instance.new("SpecialMesh")
  107. LocalScript3 = Instance.new("LocalScript")
  108. Part4 = Instance.new("Part")
  109. SpecialMesh5 = Instance.new("SpecialMesh")
  110. Tool0.Name = "Shotgun"
  111. Tool0.Parent = mas
  112. Tool0.TextureId = "http://www.roblox.com/asset/?id=19339420"
  113. Tool0.GripPos = Vector3.new(0, 0, 0.5)
  114. Part1.Name = "Handle"
  115. Part1.Parent = Tool0
  116. Part1.BrickColor = BrickColor.new("Black")
  117. Part1.Rotation = Vector3.new(0, -90, 0)
  118. Part1.FormFactor = Enum.FormFactor.Symmetric
  119. Part1.Size = Vector3.new(1, 1, 5)
  120. Part1.CFrame = CFrame.new(-6.63999891, 0.500003994, -11.4400177, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  121. Part1.BottomSurface = Enum.SurfaceType.Smooth
  122. Part1.TopSurface = Enum.SurfaceType.Smooth
  123. Part1.Color = Color3.new(0.105882, 0.164706, 0.207843)
  124. Part1.Position = Vector3.new(-6.63999891, 0.500003994, -11.4400177)
  125. Part1.Orientation = Vector3.new(0, -90, 0)
  126. Part1.Color = Color3.new(0.105882, 0.164706, 0.207843)
  127. SpecialMesh2.Parent = Part1
  128. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=94219391"
  129. SpecialMesh2.Scale = Vector3.new(0.75, 0.75, 0.75)
  130. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=94219470"
  131. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  132. SpecialMesh2.Scale = Vector3.new(0.75, 0.75, 0.75)
  133. LocalScript3.Name = "Main"
  134. LocalScript3.Parent = Tool0
  135. table.insert(cors,sandbox(LocalScript3,function()
  136. --Made by Ahtoh13131423144235
  137. --GUN SETTINGS
  138. local char=nil--Do not change this
  139. local damage=50--Bullet Damage
  140. local maxAmmo=9--Max Ammo
  141. local clip=9
  142. local ammo=32--Stored Ammo
  143. local debounce=true--Do not change this
  144. --WELDS
  145. local rightArmWeld=nil
  146. local leftArmWeld=nil
  147. local flameWeld=Instance.new("Weld")
  148. flameWeld.Parent=script.Parent.Handle
  149. flameWeld.Name="FlameWeld"
  150. flameWeld.Part0=script.Parent.Handle
  151. flameWeld.Part1=script.Parent.Flame
  152. flameWeld.C0=CFrame.new(0,0.3,-3.5)*CFrame.fromEulerAnglesXYZ(0,80.1,0)
  153. --ANIMATIONS
  154. function equip()
  155. for i=1,16 do
  156. rightArmWeld.C0=rightArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0)
  157. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0)
  158. wait()
  159. end
  160. for i=1,7 do
  161. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0,0,0.1)
  162. wait()
  163. end
  164. for i=1,7 do
  165. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0,0)
  166. wait()
  167. end
  168. for i=1,15 do
  169. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0,-0.1,0)
  170. wait()
  171. end
  172. for i=1,7 do
  173. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0)
  174. wait()
  175. end
  176. end
  177.  
  178. function shoot()
  179. for i=1,2 do
  180. rightArmWeld.C0=rightArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0)
  181. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0)
  182. script.Parent.Flame.Transparency=script.Parent.Flame.Transparency-0.4
  183. wait()
  184. end
  185. for i=1,2 do
  186. rightArmWeld.C0=rightArmWeld.C0*CFrame.fromEulerAnglesXYZ(-0.1,0,0)
  187. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(-0.1,0,0)
  188. script.Parent.Flame.Transparency=script.Parent.Flame.Transparency+0.4
  189. wait()
  190. end
  191. for i=1,5 do
  192. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0)
  193. wait()
  194. end
  195. for i=1,5 do
  196. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0.1,0)
  197. wait()
  198. end
  199. end
  200. function reload()
  201. for i=1,7 do
  202. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0.1,0)
  203. wait()
  204. end
  205. for i=1,14 do
  206. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(-0.1,0,-0.1)
  207. wait()
  208. end
  209. wait()
  210. for i=1,14 do
  211. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0.1)
  212. wait()
  213. end
  214. for i=1,7 do
  215. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0)
  216. wait()
  217. end
  218. for i=1,5 do
  219. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0)
  220. wait()
  221. end
  222. for i=1,5 do
  223. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0.1,0)
  224. wait()
  225. end
  226. end
  227. --SCRIPT
  228. script.Parent.Activated:connect(function()
  229. if debounce==false and clip>0 then
  230. debounce=true
  231. local mouse=game.Players.LocalPlayer:GetMouse()
  232. if mouse.Target~=nil then
  233. if mouse.Target.Parent:FindFirstChild("Humanoid")~=nil then
  234. mouse.Target.Parent.Humanoid.Health=mouse.Target.Parent.Humanoid.Health-damage
  235. end
  236. end
  237. shoot()
  238. local shell=Instance.new("Part")
  239. shell.Parent=game.Workspace
  240. shell.Name="Shell"
  241. shell.Size=Vector3.new(0.1,0.2,0.1)
  242. shell.Position=script.Parent.Handle.Position+Vector3.new(0.4,0,0)
  243. shell.CanCollide=true
  244. shell.BrickColor=BrickColor.new("Bright red")
  245. local mesh=Instance.new("SpecialMesh")
  246. mesh.Parent=shell
  247. mesh.MeshType="Head"
  248. game.Debris:AddItem(shell,4)
  249. clip=clip-1
  250. debounce=false
  251. elseif debounce==false and clip<=0 and ammo>0 then
  252. debounce=true
  253. reload()
  254. clip=maxAmmo
  255. ammo=ammo-maxAmmo
  256. debounce=false
  257. end
  258. end)
  259. script.Parent.Equipped:connect(function()
  260. char=script.Parent.Parent
  261. rightArmWeld=Instance.new("Weld")
  262. rightArmWeld.Parent=char.Torso
  263. rightArmWeld.Part0=char.Torso
  264. rightArmWeld.Part1=char["Right Arm"]
  265. rightArmWeld.Name="RightWeld"
  266. rightArmWeld.C0=CFrame.new(1.5,0.5,0)
  267. rightArmWeld.C1=CFrame.new(0,0.5,0)
  268. leftArmWeld=Instance.new("Weld")
  269. leftArmWeld.Parent=char.Torso
  270. leftArmWeld.Name="LeftWeld"
  271. leftArmWeld.Part0=char.Torso
  272. leftArmWeld.Part1=char["Left Arm"]
  273. leftArmWeld.C0=CFrame.new(-1.5,0.5,0)
  274. leftArmWeld.C1=CFrame.new(0,0.5,0)
  275. equip()
  276. debounce=false
  277. end)
  278. script.Parent.Unequipped:connect(function()
  279. char=nil
  280. rightArmWeld:Remove()
  281. leftArmWeld:Remove()
  282. rightArmWeld=nil
  283. leftArmWeld=nil
  284. end)
  285. end))
  286. Part4.Name = "Flame"
  287. Part4.Parent = Tool0
  288. Part4.BrickColor = BrickColor.new("Bright red")
  289. Part4.Transparency = 1
  290. Part4.Size = Vector3.new(1.97999871, 0.640000284, 0.510000348)
  291. Part4.CFrame = CFrame.new(-3.19277, 0.801472008, -11.4081182, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  292. Part4.Color = Color3.new(0.768628, 0.156863, 0.109804)
  293. Part4.Position = Vector3.new(-3.19277, 0.801472008, -11.4081182)
  294. Part4.Color = Color3.new(0.768628, 0.156863, 0.109804)
  295. SpecialMesh5.Parent = Part4
  296. SpecialMesh5.MeshType = Enum.MeshType.Sphere
  297. for i,v in pairs(mas:GetChildren()) do
  298. v.Parent = game.Players.LocalPlayer.Backpack
  299. pcall(function() v:MakeJoints() end)
  300. end
  301. mas:Destroy()
  302. for i,v in pairs(cors) do
  303. spawn(function()
  304. pcall(v)
  305. end)
  306. end
Add Comment
Please, Sign In to add comment