sIendytubble

a machine gun rifle (i didnt test it but FE)

May 13th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.93 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(),Button2Up=fakeEvent(),Button2Down=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. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  51. return m:TrigEvent(b and "Button2Down" or "Button2Up")
  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. local Mouse = Player:GetMouse()
  68. local UIS = game:GetService("UserInputService")
  69. local input = function(io,a)
  70. if a then return end
  71. --Since InputObject is a client-side instance, we create and pass table instead
  72. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  73. end
  74. UIS.InputBegan:Connect(input)
  75. UIS.InputEnded:Connect(input)
  76. local h,t
  77. --Give the server mouse data 30 times every second, but only if the values changed
  78. --If player is not moving their mouse, client won't fire events
  79. while wait(1/30) do
  80. if h~=Mouse.Hit or t~=Mouse.Target then
  81. h,t=Mouse.Hit,Mouse.Target
  82. Event:FireServer({isMouse=true,Target=t,Hit=h})
  83. end
  84. end]==],Player.Character)
  85.  
  86. ----Sandboxed game object that allows the usage of client-side methods and services
  87. --Real game object
  88. local _rg = game
  89.  
  90. --Metatable for fake service
  91. local fsmt = {
  92. __index = function(self,k)
  93. local s = rawget(self,"_RealService")
  94. if s then
  95. return typeof(s[k])=="function"
  96. and function(_,...)return s[k](s,...)end or s[k]
  97. end
  98. end,
  99. __newindex = function(self,k,v)
  100. local s = rawget(self,"_RealService")
  101. if s then s[k]=v 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 rawget(self,s) or _rg:GetService(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. RunService = FakeService({
  120. _btrs = {},
  121. RenderStepped = _rg:GetService("RunService").Heartbeat,
  122. BindToRenderStep = function(self,name,_,fun)
  123. self._btrs[name] = self.Heartbeat:Connect(fun)
  124. end,
  125. UnbindFromRenderStep = function(self,name)
  126. self._btrs[name]:Disconnect()
  127. end,
  128. },"RunService")
  129. }
  130. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  131. g.service = g.GetService
  132. FakeService(g,game)
  133. --Changing owner to fake player object to support owner:GetMouse()
  134. game,owner = g,g.Players.LocalPlayer
  135. end
  136. char = game.Players.LocalPlayer.Character
  137. player = game.Players.LocalPlayer
  138. mouse = player:GetMouse()
  139. mas = char
  140. shooting = false
  141. Part0 = Instance.new("Part")
  142. SpecialMesh1 = Instance.new("SpecialMesh")
  143. Part0.Name = "Assault Rifle"
  144. Part0.Parent = mas
  145. function shootsound()
  146. coroutine.resume(coroutine.create(function()
  147. shoot = Instance.new("Sound",Part0)
  148. shoot.Volume = 10
  149. shoot.PlaybackSpeed = 1
  150. shoot.SoundId = "rbxassetid://3289652262"
  151. shoot:Play()
  152. wait(2)
  153. shoot:Destroy()
  154. end))
  155. end
  156. Part0.CFrame = CFrame.new(-7.32639599, 14.2976122, 14.3406916, -0.106925137, 0.994266748, 0.000791709346, 1.85333519e-12, -0.000796274282, 0.999999642, 0.994266987, 0.106925115, 8.51417499e-05)
  157. Part0.Orientation = Vector3.new(-89.9499969, 83.8600006, 180)
  158. Part0.Position = Vector3.new(-7.32639599, 14.2976122, 14.3406916)
  159. Part0.Rotation = Vector3.new(-90, 0.0500000007, -96.1399994)
  160. Part0.Color = Color3.new(0.105882, 0.164706, 0.207843)
  161. Part0.Size = Vector3.new(0.400000006, 3.4000001, 0.800000012)
  162. Part0.BrickColor = BrickColor.new("Black")
  163. Part0.brickColor = BrickColor.new("Black")
  164. Part0.FormFactor = Enum.FormFactor.Custom
  165. Part0.CanCollide = false
  166. Part0.formFactor = Enum.FormFactor.Custom
  167. SpecialMesh1.Parent = Part0
  168. SpecialMesh1.MeshId = "http://www.roblox.com/asset/?id=72012671"
  169. SpecialMesh1.VertexColor = Vector3.new(2, 2, 2)
  170. SpecialMesh1.TextureId = "http://www.roblox.com/asset/?id=72012605"
  171. SpecialMesh1.MeshType = Enum.MeshType.FileMesh
  172. weld = Instance.new("Weld",Part0)
  173. weld.Part0 = char["Right Arm"]
  174. weld.Part1 = Part0
  175. weld.C0 = CFrame.new(0,-1.5,-0.5) * CFrame.Angles(math.rad(180),math.rad(0),math.rad(-30))
  176. rs = Instance.new("Weld",char.Torso)
  177. rs.Part0 = char.Torso["Right Shoulder"].Part0
  178. rs.Part1 = char.Torso["Right Shoulder"].Part1
  179. rs.C0 = CFrame.new(0.5,0.5,-0.5) * CFrame.Angles(math.rad(0),math.rad(120),math.rad(90))
  180. rs.C1 = char.Torso["Right Shoulder"].C1
  181. ls = Instance.new("Weld",char.Torso)
  182. ls.Part0 = char.Torso["Left Shoulder"].Part0
  183. ls.Part1 = char.Torso["Left Shoulder"].Part1
  184. ls.C0 = CFrame.new(-0.6,0.5,-1) * CFrame.Angles(math.rad(180),math.rad(-57),math.rad(90))
  185. ls.C1 = char.Torso["Left Shoulder"].C1
  186. Weld1 = Instance.new("Weld")
  187. BillboardGui2 = Instance.new("BillboardGui")
  188. ImageLabel3 = Instance.new("ImageLabel")
  189. Part02 = Instance.new("Part")
  190. Part02.Parent = Part0
  191. Part02.CFrame = CFrame.new(-7.52682972, 18.6985626, 9.31794739, 1, -5.96046448e-08, 6.5567086e-08, -6.55670789e-08, 1.1356552e-07, 1, -5.96046448e-08, -1, 1.1356552e-07)
  192. Part02.Orientation = Vector3.new(-90, 0, 0)
  193. Part02.Position = Vector3.new(-7.52682972, 18.6985626, 9.31794739)
  194. Part02.Rotation = Vector3.new(-90, 0, 0)
  195. Part02.Transparency = 1
  196. Part02.Size = Vector3.new(1, 1, 1)
  197. Part02.BottomSurface = Enum.SurfaceType.Smooth
  198. Part02.TopSurface = Enum.SurfaceType.Smooth
  199. Weld1.Parent = Part02
  200. Weld1.C0 = CFrame.new(0, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
  201. Weld1.Part0 = Part0
  202. Weld1.Part1 = Part02
  203. Weld1.part1 = Part02
  204. BillboardGui2.Parent = Part02
  205. BillboardGui2.LightInfluence = 1
  206. BillboardGui2.Size = UDim2.new(2, 0, 2, 0)
  207. BillboardGui2.Active = true
  208. BillboardGui2.ClipsDescendants = true
  209. BillboardGui2.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  210. ImageLabel3.Parent = BillboardGui2
  211. ImageLabel3.Size = UDim2.new(1, 0, 1, 0)
  212. ImageLabel3.BackgroundColor = BrickColor.new("Institutional white")
  213. ImageLabel3.BackgroundColor3 = Color3.new(1, 1, 1)
  214. ImageLabel3.BackgroundTransparency = 1
  215. ImageLabel3.ImageTransparency = 1
  216. ImageLabel3.Image = "http://www.roblox.com/asset/?id=156580315"
  217. head = char.Head
  218. game:GetService("RunService").RenderStepped:Connect(function()
  219. if shooting == true then
  220. shootsound()
  221. ImageLabel3.ImageTransparency = 0
  222. ImageLabel3.Rotation = ImageLabel3.Rotation + 90
  223. if mouse.Target.Anchored == false then
  224. p = mouse.Target
  225. p.Velocity = Vector3.new(p.Velocity.X + (head.CFrame.lookVector.X * 18), p.Velocity.Y + (head.CFrame.lookVector.Y * 18) + 8, p.Velocity.Z + (head.CFrame.lookVector.Z * 18))
  226. end
  227. if mouse.Target.Parent:FindFirstChildOfClass("Humanoid") then
  228. mouse.Target.Parent:FindFirstChildOfClass("Humanoid").Health = mouse.Target.Parent:FindFirstChildOfClass("Humanoid").Health - 43.5
  229. end
  230. wait(0.6)
  231. else
  232. ImageLabel3.ImageTransparency = 1
  233. end
  234. end)
  235. mouse.Button1Down:Connect(function()
  236. shooting = true
  237. end)
  238. mouse.Button1Up:Connect(function()
  239. shooting = false
  240. end)
Add Comment
Please, Sign In to add comment