Advertisement
Guest User

Untitled

a guest
May 25th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.54 KB | None | 0 0
  1. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  2. local Player,game,owner = owner,game
  3. local RealPlayer = Player
  4. do
  5. print("FE Compatibility code by Mokiros")
  6. local rp = RealPlayer
  7. script.Parent = rp.Character
  8.  
  9. --RemoteEvent for communicating
  10. local Event = Instance.new("RemoteEvent")
  11. Event.Name = "UserInput_Event"
  12.  
  13. --Fake event to make stuff like Mouse.KeyDown work
  14. local function fakeEvent()
  15. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  16. t.connect = t.Connect
  17. return t
  18. end
  19.  
  20. --Creating fake input objects with fake variables
  21. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  22. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  23. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  24. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  25. end}
  26. --Merged 2 functions into one by checking amount of arguments
  27. CAS.UnbindAction = CAS.BindAction
  28.  
  29. --This function will trigger the events that have been :Connect()'ed
  30. local function te(self,ev,...)
  31. local t = m[ev]
  32. if t and t._fakeEvent then
  33. for _,f in pairs(t.Functions) do
  34. f(...)
  35. end
  36. end
  37. end
  38. m.TrigEvent = te
  39. UIS.TrigEvent = te
  40.  
  41. Event.OnServerEvent:Connect(function(plr,io)
  42. if plr~=rp then return end
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. if not io.isMouse then
  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 Mouse = Player:GetMouse()
  66. local UIS = game:GetService("UserInputService")
  67. local input = function(io,a)
  68. if a then return end
  69. --Since InputObject is a client-side instance, we create and pass table instead
  70. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  71. end
  72. UIS.InputBegan:Connect(input)
  73. UIS.InputEnded:Connect(input)
  74.  
  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.  
  85. ----Sandboxed game object that allows the usage of client-side methods and services
  86. --Real game object
  87. local _rg = game
  88.  
  89. --Metatable for fake service
  90. local fsmt = {
  91. __index = function(self,k)
  92. local s = rawget(self,"_RealService")
  93. if s then return s[k] end
  94. end,
  95. __newindex = function(self,k,v)
  96. local s = rawget(self,"_RealService")
  97. if s then s[k]=v end
  98. end,
  99. __call = function(self,...)
  100. local s = rawget(self,"_RealService")
  101. if s then return s(...) end
  102. end
  103. }
  104. local function FakeService(t,RealService)
  105. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  106. return setmetatable(t,fsmt)
  107. end
  108.  
  109. --Fake game object
  110. local g = {
  111. GetService = function(self,s)
  112. return self[s]
  113. end,
  114. Players = FakeService({
  115. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  116. },"Players"),
  117. UserInputService = FakeService(UIS,"UserInputService"),
  118. ContextActionService = FakeService(CAS,"ContextActionService"),
  119. }
  120. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  121. g.service = g.GetService
  122.  
  123. g.RunService = FakeService({
  124. RenderStepped = _rg:GetService("RunService").Heartbeat,
  125. BindToRenderStep = function(self,name,_,fun)
  126.  
  127. end,
  128. UnbindFromRenderStep = function(self,name)
  129. self._btrs[name]:Disconnect()
  130. end,
  131. },"RunService")
  132.  
  133. setmetatable(g,{
  134. __index=function(self,s)
  135. return _rg:GetService(s) or typeof(_rg[s])=="function"
  136. and function(_,...)return _rg[s](_rg,...)end or _rg[s]
  137. end,
  138. __newindex = fsmt.__newindex,
  139. __call = fsmt.__call
  140. })
  141. --Changing owner to fake player object to support owner:GetMouse()
  142. game,owner = g,g.Players.LocalPlayer
  143. end
  144.  
  145. --Converted with ttyyuu12345's model to script plugin v4
  146. function sandbox(var,func)
  147. local env = getfenv(func)
  148. local newenv = setmetatable({},{
  149. __index = function(self,k)
  150. if k=="script" then
  151. return var
  152. else
  153. return env[k]
  154. end
  155. end,
  156. })
  157. setfenv(func,newenv)
  158. return func
  159. end
  160. cors = {}
  161. mas = Instance.new("Model",game:GetService("Lighting"))
  162. Tool0 = Instance.new("Tool")
  163. Part1 = Instance.new("Part")
  164. SpecialMesh2 = Instance.new("SpecialMesh")
  165. LocalScript3 = Instance.new("LocalScript")
  166. Part4 = Instance.new("Part")
  167. SpecialMesh5 = Instance.new("SpecialMesh")
  168. Tool0.Name = "Shotgun"
  169. Tool0.Parent = mas
  170. Tool0.TextureId = "http://www.roblox.com/asset/?id=19339420"
  171. Tool0.GripPos = Vector3.new(0, 0, 0.5)
  172. Part1.Name = "Handle"
  173. Part1.Parent = Tool0
  174. Part1.BrickColor = BrickColor.new("Black")
  175. Part1.Rotation = Vector3.new(0, -90, 0)
  176. Part1.FormFactor = Enum.FormFactor.Symmetric
  177. Part1.Size = Vector3.new(1, 1, 5)
  178. Part1.CFrame = CFrame.new(-6.63999891, 0.500003994, -11.4400177, 0, 0, -1, 0, 1, 0, 1, 0, 0)
  179. Part1.BottomSurface = Enum.SurfaceType.Smooth
  180. Part1.TopSurface = Enum.SurfaceType.Smooth
  181. Part1.Color = Color3.new(0.105882, 0.164706, 0.207843)
  182. Part1.Position = Vector3.new(-6.63999891, 0.500003994, -11.4400177)
  183. Part1.Orientation = Vector3.new(0, -90, 0)
  184. Part1.Color = Color3.new(0.105882, 0.164706, 0.207843)
  185. SpecialMesh2.Parent = Part1
  186. SpecialMesh2.MeshId = "http://www.roblox.com/asset/?id=94219391"
  187. SpecialMesh2.Scale = Vector3.new(0.75, 0.75, 0.75)
  188. SpecialMesh2.TextureId = "http://www.roblox.com/asset/?id=94219470"
  189. SpecialMesh2.MeshType = Enum.MeshType.FileMesh
  190. SpecialMesh2.Scale = Vector3.new(0.75, 0.75, 0.75)
  191. LocalScript3.Name = "Main"
  192. LocalScript3.Parent = Tool0
  193. table.insert(cors,sandbox(LocalScript3,function()
  194. --Made by Ahtoh13131423144235
  195. --GUN SETTINGS
  196. local char=nil--Do not change this
  197. local damage=50--Bullet Damage
  198. local maxAmmo=9--Max Ammo
  199. local clip=9
  200. local ammo=32--Stored Ammo
  201. local debounce=true--Do not change this
  202. --WELDS
  203. local rightArmWeld=nil
  204. local leftArmWeld=nil
  205. local flameWeld=Instance.new("Weld")
  206. flameWeld.Parent=script.Parent.Handle
  207. flameWeld.Name="FlameWeld"
  208. flameWeld.Part0=script.Parent.Handle
  209. flameWeld.Part1=script.Parent.Flame
  210. flameWeld.C0=CFrame.new(0,0.3,-3.5)*CFrame.fromEulerAnglesXYZ(0,80.1,0)
  211. --ANIMATIONS
  212. function equip()
  213. for i=1,16 do
  214. rightArmWeld.C0=rightArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0)
  215. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0)
  216. wait()
  217. end
  218. for i=1,7 do
  219. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0,0,0.1)
  220. wait()
  221. end
  222. for i=1,7 do
  223. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0,0)
  224. wait()
  225. end
  226. for i=1,15 do
  227. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0,-0.1,0)
  228. wait()
  229. end
  230. for i=1,7 do
  231. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0)
  232. wait()
  233. end
  234. end
  235.  
  236. function shoot()
  237. for i=1,2 do
  238. rightArmWeld.C0=rightArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0)
  239. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0)
  240. script.Parent.Flame.Transparency=script.Parent.Flame.Transparency-0.4
  241. wait()
  242. end
  243. for i=1,2 do
  244. rightArmWeld.C0=rightArmWeld.C0*CFrame.fromEulerAnglesXYZ(-0.1,0,0)
  245. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(-0.1,0,0)
  246. script.Parent.Flame.Transparency=script.Parent.Flame.Transparency+0.4
  247. wait()
  248. end
  249. for i=1,5 do
  250. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0)
  251. wait()
  252. end
  253. for i=1,5 do
  254. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0.1,0)
  255. wait()
  256. end
  257. end
  258. function reload()
  259. for i=1,7 do
  260. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0.1,0)
  261. wait()
  262. end
  263. for i=1,14 do
  264. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(-0.1,0,-0.1)
  265. wait()
  266. end
  267. wait()
  268. for i=1,14 do
  269. leftArmWeld.C0=leftArmWeld.C0*CFrame.fromEulerAnglesXYZ(0.1,0,0.1)
  270. wait()
  271. end
  272. for i=1,7 do
  273. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0)
  274. wait()
  275. end
  276. for i=1,5 do
  277. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(-0.1,-0.1,0)
  278. wait()
  279. end
  280. for i=1,5 do
  281. leftArmWeld.C0=leftArmWeld.C0*CFrame.new(0.1,0.1,0)
  282. wait()
  283. end
  284. end
  285. --SCRIPT
  286. script.Parent.Activated:connect(function()
  287. if debounce==false and clip>0 then
  288. debounce=true
  289. local mouse=game.Players.LocalPlayer:GetMouse()
  290. if mouse.Target~=nil then
  291. if mouse.Target.Parent:FindFirstChild("Humanoid")~=nil then
  292. mouse.Target.Parent.Humanoid.Health=mouse.Target.Parent.Humanoid.Health-damage
  293. end
  294. end
  295. shoot()
  296. local shell=Instance.new("Part")
  297. shell.Parent=game.Workspace
  298. shell.Name="Shell"
  299. shell.Size=Vector3.new(0.1,0.2,0.1)
  300. shell.Position=script.Parent.Handle.Position+Vector3.new(0.4,0,0)
  301. shell.CanCollide=true
  302. shell.BrickColor=BrickColor.new("Bright red")
  303. local mesh=Instance.new("SpecialMesh")
  304. mesh.Parent=shell
  305. mesh.MeshType="Head"
  306. game.Debris:AddItem(shell,4)
  307. clip=clip-1
  308. debounce=false
  309. elseif debounce==false and clip<=0 and ammo>0 then
  310. debounce=true
  311. reload()
  312. clip=maxAmmo
  313. ammo=ammo-maxAmmo
  314. debounce=false
  315. end
  316. end)
  317. script.Parent.Equipped:connect(function()
  318. char=script.Parent.Parent
  319. rightArmWeld=Instance.new("Weld")
  320. rightArmWeld.Parent=char.Torso
  321. rightArmWeld.Part0=char.Torso
  322. rightArmWeld.Part1=char["Right Arm"]
  323. rightArmWeld.Name="RightWeld"
  324. rightArmWeld.C0=CFrame.new(1.5,0.5,0)
  325. rightArmWeld.C1=CFrame.new(0,0.5,0)
  326. leftArmWeld=Instance.new("Weld")
  327. leftArmWeld.Parent=char.Torso
  328. leftArmWeld.Name="LeftWeld"
  329. leftArmWeld.Part0=char.Torso
  330. leftArmWeld.Part1=char["Left Arm"]
  331. leftArmWeld.C0=CFrame.new(-1.5,0.5,0)
  332. leftArmWeld.C1=CFrame.new(0,0.5,0)
  333. equip()
  334. debounce=false
  335. end)
  336. script.Parent.Unequipped:connect(function()
  337. char=nil
  338. rightArmWeld:Remove()
  339. leftArmWeld:Remove()
  340. rightArmWeld=nil
  341. leftArmWeld=nil
  342. end)
  343. end))
  344. Part4.Name = "Flame"
  345. Part4.Parent = Tool0
  346. Part4.BrickColor = BrickColor.new("Bright red")
  347. Part4.Transparency = 1
  348. Part4.Size = Vector3.new(1.97999871, 0.640000284, 0.510000348)
  349. Part4.CFrame = CFrame.new(-3.19277, 0.801472008, -11.4081182, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  350. Part4.Color = Color3.new(0.768628, 0.156863, 0.109804)
  351. Part4.Position = Vector3.new(-3.19277, 0.801472008, -11.4081182)
  352. Part4.Color = Color3.new(0.768628, 0.156863, 0.109804)
  353. SpecialMesh5.Parent = Part4
  354. SpecialMesh5.MeshType = Enum.MeshType.Sphere
  355. for i,v in pairs(mas:GetChildren()) do
  356. v.Parent = game.Players.LocalPlayer.Backpack
  357. pcall(function() v:MakeJoints() end)
  358. end
  359. mas:Destroy()
  360. for i,v in pairs(cors) do
  361. spawn(function()
  362. pcall(v)
  363. end)
  364. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement