Advertisement
Guest User

AK-47

a guest
Oct 27th, 2019
3,341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.50 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,Mouse,mouse,UserInputService,ContextActionService = owner
  3. do
  4. print("FE Compatibility code by Mokiros")
  5. script.Parent = Player.Character
  6.  
  7. --RemoteEvent for communicating
  8. local Event = Instance.new("RemoteEvent")
  9. Event.Name = "UserInput_Event"
  10.  
  11. --Fake event to make stuff like Mouse.KeyDown work
  12. local function fakeEvent()
  13. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  14. t.connect = t.Connect
  15. return t
  16. end
  17.  
  18. --Creating fake input objects with fake variables
  19. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  20. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  21. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  22. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  23. end}
  24. --Merged 2 functions into one by checking amount of arguments
  25. CAS.UnbindAction = CAS.BindAction
  26.  
  27. --This function will trigger the events that have been :Connect()'ed
  28. local function te(self,ev,...)
  29. local t = m[ev]
  30. if t and t._fakeEvent and t.Function then
  31. t.Function(...)
  32. end
  33. end
  34. m.TrigEvent = te
  35. UIS.TrigEvent = te
  36.  
  37. Event.OnServerEvent:Connect(function(plr,io)
  38. if plr~=Player then return end
  39. if io.isMouse then
  40. m.Target = io.Target
  41. m.Hit = io.Hit
  42. else
  43. local b = io.UserInputState == Enum.UserInputState.Begin
  44. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  45. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  46. end
  47. for _,t in pairs(CAS.Actions) do
  48. for _,k in pairs(t.Keys) do
  49. if k==io.KeyCode then
  50. t.Function(t.Name,io.UserInputState,io)
  51. end
  52. end
  53. end
  54. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  55. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  56. end
  57. end)
  58. Event.Parent = NLS([==[
  59. local Player = game:GetService("Players").LocalPlayer
  60. local Event = script:WaitForChild("UserInput_Event")
  61.  
  62. local UIS = game:GetService("UserInputService")
  63. local input = function(io,a)
  64. if a then return end
  65. --Since InputObject is a client-side instance, we create and pass table instead
  66. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  67. end
  68. UIS.InputBegan:Connect(input)
  69. UIS.InputEnded:Connect(input)
  70.  
  71. local Mouse = Player:GetMouse()
  72. local h,t
  73. --Give the server mouse data 30 times every second, but only if the values changed
  74. --If player is not moving their mouse, client won't fire events
  75. while wait(1/30) do
  76. if h~=Mouse.Hit or t~=Mouse.Target then
  77. h,t=Mouse.Hit,Mouse.Target
  78. Event:FireServer({isMouse=true,Target=t,Hit=h})
  79. end
  80. end]==],Player.Character)
  81. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  82. end
  83. --[[
  84. Objects Skipped: 41
  85. IntValue: 4
  86. UnionOperation: 31
  87. LocalScript: 1
  88. NumberValue: 1
  89. ModuleScript: 3
  90. Script: 1
  91. --]]
  92.  
  93. local ak47 = Instance.new("Tool")
  94. local thumbnailcamera = Instance.new("Camera")
  95. local aimpart = Instance.new("Part")
  96. local mesh = Instance.new("SpecialMesh")
  97. local chamber = Instance.new("Part")
  98. local mesh_2 = Instance.new("CylinderMesh")
  99. local handle = Instance.new("Part")
  100. local magout = Instance.new("Sound")
  101. local magin = Instance.new("Sound")
  102. local prime = Instance.new("Sound")
  103. local mesh_3 = Instance.new("BlockMesh")
  104. local firesound = Instance.new("Sound")
  105. local main = Instance.new("Part")
  106. local mesh_4 = Instance.new("BlockMesh")
  107. local N1flashfxsmoke = Instance.new("ParticleEmitter")
  108. local flashfxflash = Instance.new("ParticleEmitter")
  109. local flashfxlight = Instance.new("PointLight")
  110.  
  111. ak47.Name = "AK47"
  112. ak47.ToolTip = "Russian Assualt Rifle"
  113. ak47.Parent = game.StarterPack
  114. thumbnailcamera.FieldOfView = 40
  115. thumbnailcamera.Name = "ThumbnailCamera"
  116. thumbnailcamera.Focus = CFrame.new(154.373, 1.018, -87.883)
  117. thumbnailcamera.CFrame = CFrame.new(154.346, 0.976, -89.882) * CFrame.Angles(3.121, -0.013, 3.141)
  118. thumbnailcamera.Parent = AK47
  119. aimpart.Anchored = true
  120. aimpart.CanCollide = false
  121. aimpart.Size = Vector3.new(0.212, 0.212, 0.212)
  122. aimpart.Orientation = Vector3.new(0, 90, 0)
  123. aimpart.BottomSurface = Enum.SurfaceType.Smooth
  124. aimpart.Material = Enum.Material.SmoothPlastic
  125. aimpart.Name = "AimPart"
  126. aimpart.Transparency = 1
  127. aimpart.TopSurface = Enum.SurfaceType.Smooth
  128. aimpart.BrickColor = BrickColor.new("Black")
  129. aimpart.Color = Color3.new(0.105882, 0.164706, 0.207843)
  130. aimpart.Parent = AK47
  131. aimpart.CFrame = CFrame.new(155.685, 1.174, -84.508) * CFrame.Angles(1.478, 1.568, -1.49)
  132. mesh.Scale = Vector3.new(0.044, 0.042, 83.227)
  133. mesh.MeshType = Enum.MeshType.Brick
  134. mesh.Parent = AimPart
  135. chamber.Anchored = true
  136. chamber.CanCollide = false
  137. chamber.Size = Vector3.new(0.212, 0.212, 0.212)
  138. chamber.BottomSurface = Enum.SurfaceType.Smooth
  139. chamber.Orientation = Vector3.new(0, 30, 90.03)
  140. chamber.Name = "Chamber"
  141. chamber.Transparency = 1
  142. chamber.TopSurface = Enum.SurfaceType.Smooth
  143. chamber.Parent = AK47
  144. chamber.CFrame = CFrame.new(154.462, 1.035, -84.553) * CFrame.Angles(0, 0.524, 1.571)
  145. mesh_2.Scale = Vector3.new(0.285, 0.856, 0.285)
  146. mesh_2.Parent = Chamber
  147. handle.Anchored = true
  148. handle.CanCollide = false
  149. handle.Size = Vector3.new(0.2, 0.2, 0.2)
  150. handle.Orientation = Vector3.new(0, 89.99, 0)
  151. handle.BottomSurface = Enum.SurfaceType.Smooth
  152. handle.Material = Enum.Material.SmoothPlastic
  153. handle.Name = "Handle"
  154. handle.Transparency = 1
  155. handle.TopSurface = Enum.SurfaceType.Smooth
  156. handle.BrickColor = BrickColor.new("Dark stone grey")
  157. handle.Color = Color3.new(0.388235, 0.372549, 0.384314)
  158. handle.Parent = AK47
  159. handle.CFrame = CFrame.new(154.999, 0.468, -84.507) * CFrame.Angles(0, 1.571, 0)
  160. magout.Volume = 1
  161. magout.Name = "MagOut"
  162. magout.SoundId = "rbxassetid://457042936"
  163. magout.Parent = Handle
  164. magin.Volume = 1
  165. magin.Name = "MagIn"
  166. magin.SoundId = "rbxassetid://457043231"
  167. magin.Parent = Handle
  168. prime.Volume = 1
  169. prime.Name = "Prime"
  170. prime.SoundId = "rbxassetid://206942149"
  171. prime.Parent = Handle
  172. mesh_3.Scale = Vector3.new(0.742, 0.706, 0.706)
  173. mesh_3.Parent = Handle
  174. firesound.Name = "FireSound"
  175. firesound.SoundId = "rbxassetid://766484843"
  176. firesound.RollOffMode = Enum.RollOffMode.Linear
  177. firesound.Volume = 3
  178. firesound.Parent = Handle
  179. main.Anchored = true
  180. main.CanCollide = false
  181. main.Size = Vector3.new(0.212, 0.212, 0.212)
  182. main.Orientation = Vector3.new(90, -90.01, 0)
  183. main.BottomSurface = Enum.SurfaceType.Smooth
  184. main.Material = Enum.Material.SmoothPlastic
  185. main.Name = "Main"
  186. main.Transparency = 1
  187. main.TopSurface = Enum.SurfaceType.Smooth
  188. main.BrickColor = BrickColor.new("Bright orange")
  189. main.Color = Color3.new(0.854902, 0.521569, 0.254902)
  190. main.Parent = AK47
  191. main.CFrame = CFrame.new(152.146, 0.928, -84.506) * CFrame.Angles(1.571, 0, 1.571)
  192. mesh_4.Scale = Vector3.new(0.764, 0.727, 0.727)
  193. mesh_4.Parent = Main
  194. N1flashfxsmoke.Enabled = false
  195. N1flashfxsmoke.Name = "1FlashFX[Smoke]"
  196. N1flashfxsmoke.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0, 0.6), NumberSequenceKeypoint.new(1, 1)})
  197. N1flashfxsmoke.Lifetime = NumberRange.new(1.25, 1.5)
  198. N1flashfxsmoke.LightEmission = 0.1
  199. N1flashfxsmoke.Speed = NumberRange.new(5, 7)
  200. N1flashfxsmoke.Color = ColorSequence.new(Color3.new(0.27451, 0.27451, 0.27451), Color3.new(0.27451, 0.27451, 0.27451))
  201. N1flashfxsmoke.Rotation = NumberRange.new(0, 360)
  202. N1flashfxsmoke.Rate = 100
  203. N1flashfxsmoke.RotSpeed = NumberRange.new(10)
  204. N1flashfxsmoke.Texture = "http://www.roblox.com/asset/?id=244514423"
  205. N1flashfxsmoke.Size = NumberSequence.new({NumberSequenceKeypoint.new(0, 0), NumberSequenceKeypoint.new(1, 0)})
  206. N1flashfxsmoke.SpreadAngle = Vector2.new(15, 15)
  207. N1flashfxsmoke.Parent = Main
  208. flashfxflash.Enabled = false
  209. flashfxflash.Lifetime = NumberRange.new(0.05, 0.075)
  210. flashfxflash.LightEmission = 1
  211. flashfxflash.Name = "FlashFX[Flash]"
  212. flashfxflash.Transparency = NumberSequence.new({NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.636, 0.9, 0.069), NumberSequenceKeypoint.new(0.955, 0.887, 0.05), NumberSequenceKeypoint.new(1, 1)})
  213. flashfxflash.Rate = 1000
  214. flashfxflash.Color = ColorSequence.new(Color3.new(1, 1, 0.498039), Color3.new(1, 1, 0.498039))
  215. flashfxflash.RotSpeed = NumberRange.new(22)
  216. flashfxflash.Texture = "http://www.roblox.com/asset/?id=242102147"
  217. flashfxflash.Parent = Main
  218. flashfxlight.Enabled = false
  219. flashfxlight.Brightness = 10
  220. flashfxlight.Range = 0
  221. flashfxlight.Color = Color3.new(1, 1, 0.498039)
  222. flashfxlight.Name = "FlashFX[Light]"
  223. flashfxlight.Parent = Main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement