yougotoof

tf2 scout

Dec 30th, 2018 (edited)
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.05 KB | None | 0 0
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = game.Players.QuiIity
  5. do
  6. print("FE Compatibility code by Mokiros")
  7. local rp = game.Players.QuiIity
  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").QuiIity
  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
  97. return typeof(s[k])=="function"
  98. and function(_,...)return s[k](s,...)end or s[k]
  99. end
  100. end,
  101. __newindex = function(self,k,v)
  102. local s = rawget(self,"_RealService")
  103. if s then s[k]=v end
  104. end
  105. }
  106. local function FakeService(t,RealService)
  107. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  108. return setmetatable(t,fsmt)
  109. end
  110.  
  111. --Fake game object
  112. local g = {
  113. GetService = function(self,s)
  114. return rawget(self,s) or _rg:GetService(s)
  115. end,
  116. Players = FakeService({
  117. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  118. },"Players"),
  119. UserInputService = FakeService(UIS,"UserInputService"),
  120. ContextActionService = FakeService(CAS,"ContextActionService"),
  121. RunService = FakeService({
  122. _btrs = {},
  123. RenderStepped = _rg:GetService("RunService").Heartbeat,
  124. BindToRenderStep = function(self,name,_,fun)
  125. self._btrs[name] = self.Heartbeat:Connect(fun)
  126. end,
  127. UnbindFromRenderStep = function(self,name)
  128. self._btrs[name]:Disconnect()
  129. end,
  130. },"RunService")
  131. }
  132. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  133. g.service = g.GetService
  134. FakeService(g,game)
  135. --Changing owner to fake player object to support owner:GetMouse()
  136. game,owner = g,g.Players.LocalPlayer
  137. end
  138.  
  139. plr=game:service'Players'.QuiIity
  140. ch=plr.Character
  141. torso=ch.Torso
  142. m=plr:GetMouse()
  143. cfn=CFrame.new
  144. mr=math.rad
  145. ang=CFrame.Angles
  146. int=Instance.new
  147.  
  148. loaded=6
  149. ammo=36
  150.  
  151. if ch:findFirstChild('Scattergun') then
  152. ch.Scattergun:Destroy()
  153. end
  154.  
  155. local shoot=int("Sound",ch.Head)
  156. shoot.SoundId='http://www.roblox.com/asset?id=10209828'
  157. shoot.Volume=1
  158. shoot.Pitch = 1
  159.  
  160. local click=int("Sound",ch.Head)
  161. click.SoundId='http://www.roblox.com/asset?id=10209834'
  162. click.Volume=1
  163. click.Pitch=1
  164. game:service'ContentProvider':Preload(shoot.SoundId)
  165. game:service'ContentProvider':Preload(click.SoundId)
  166.  
  167.  
  168. local tube=Instance.new("Model",ch)
  169. tube.Name='Scattergun'
  170.  
  171. function weld(p0,p1,c0)--basic weld function
  172. local w=Instance.new("Weld",p0)
  173. w.Part0=p0
  174. w.Part1=p1
  175. w.C0=c0
  176. return w
  177. end
  178.  
  179. Weld = function(p0,p1,x,y,z,rx,ry,rz,par)--recommend to use this with my weld. use this function only with arm lockers.
  180. p0.Position = p1.Position
  181. local w = Instance.new('Motor',par or p0)
  182. w.Part0 = p1
  183. w.Part1 = p0
  184. w.C0 = CFrame.new(x or 0,y or 0,z or 0)*CFrame.Angles(rx or 0,ry or 0,rz or 0)
  185. w.MaxVelocity = .1
  186. return w
  187. end
  188.  
  189.  
  190. function cp(parent,color,size,anchored,cancollide)--creates a part. automagically returns the part so you can edit it manually.
  191. local newp=Instance.new("Part",parent)
  192. newp.Material = "SmoothPlastic"
  193. newp.TopSurface=10
  194. newp.BottomSurface=10
  195. newp.LeftSurface=10
  196. newp.RightSurface=10
  197. newp.BackSurface=10
  198. newp.FrontSurface=10
  199. newp.FormFactor="Custom"
  200. newp.BrickColor=BrickColor.new(color)
  201. newp.Size=size
  202. newp.Anchored=anchored
  203. newp.CanCollide=cancollide
  204. newp:BreakJoints()
  205. return newp
  206. end
  207.  
  208. Tween = function(Weld, Stop, Step,a)--epik tween function. simple, no lag, awesome.
  209. ypcall(function()--- TweenWeld function (not made by me)
  210. local func = function()
  211. local Start = Weld.C1
  212. local X1, Y1, Z1 = Start:toEulerAnglesXYZ()
  213. local Stop = Stop
  214. local X2, Y2, Z2 = Stop:toEulerAnglesXYZ()
  215.  
  216. for i = 0, 1, Step or .1 do
  217. Weld.C1 = CFrame.new( (Start.p.X * (1 - i)) + (Stop.p.X * i),
  218. (Start.p.Y * (1 - i)) + (Stop.p.Y * i),
  219. (Start.p.Z * (1 - i)) + (Stop.p.Z * i)) * CFrame.fromEulerAnglesXYZ(
  220. (X1 * (1 - i)) + (X2 * i), (Y1 * (1 - i)) + (Y2 * i),
  221. (Z1 * (1 - i)) + (Z2 * i) )
  222. wait()
  223. end
  224.  
  225. Weld.C1 = Stop
  226. end
  227.  
  228. if a then coroutine.wrap(func)() else func() end
  229. end)
  230. end
  231.  
  232. rabr = cp(tube,'White',Vector3.new(1,1,1),false,false) rabr.Transparency = 1 rabr.Name='Locker'
  233. rabr.Position = torso.Position
  234. rw = Weld(rabr,torso,1.5,.5,0,0,0,0) rw.Parent = tube rw.Name = 'rw'
  235. w = Instance.new("Weld",tube)
  236. w.Part0,w.Part1 = ch['Right Arm'],rabr
  237. w.C1 = CFrame.new(0,-.5,0)
  238.  
  239. labr = cp(tube,'White',Vector3.new(1,1,1),false,false) labr.Transparency = 1 labr.Name='Locker'
  240. labr.Position = torso.Position
  241. lw = Weld(labr,torso,-1.5,.5,0,0,0,0) lw.Parent = tube lw.Name = 'lw'
  242. ww = Instance.new("Weld",tube)
  243. ww.Part0,ww.Part1 = ch['Left Arm'],labr
  244. ww.C1 = CFrame.new(0,-.5,0)
  245.  
  246.  
  247. local shaft=cp(tube,"Brown",Vector3.new(1,1,1))
  248. shaft.Material='Wood'
  249. local mw=weld(ch['Right Arm'],shaft,CFrame.new(0,-1.9,-1)*ang(mr(-45),mr(-14),0))
  250. local blk=int('BlockMesh',shaft)
  251. blk.Scale=Vector3.new(0.5,0.2,1)
  252.  
  253. local shaft2=cp(tube,"Brown",Vector3.new(1,1,1))
  254. weld(shaft,shaft2,CFrame.new(0,0,-0.65)*ang(mr(-90),0,0))
  255. shaft2.Material="Wood"
  256. local blk=int('SpecialMesh',shaft2)
  257. blk.MeshType='Wedge'
  258. blk.Scale=Vector3.new(0.5,0.3,0.2)
  259.  
  260. --[[
  261. local shaft3=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  262. weld(shaft,shaft3,CFrame.new(0,1,-0.65)*ang(mr(45),0,0)*CFrame.new(0,0,0)*ang(0,mr(30),0))
  263. local blk=int('SpecialMesh',shaft3)
  264. blk.MeshType='Wedge'
  265. blk.Scale=Vector3.new(0.5,0.2,0.2)
  266. ]]
  267.  
  268. local cyla=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  269. Instance.new("CylinderMesh",cyla).Scale=Vector3.new(0.71,0.5,0.71)
  270. cyla.Reflectance=0.1
  271. weld(shaft,cyla,CFrame.new(0,0.094,0.59)*ang(mr(90),0,0))
  272. local bh=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  273. weld(cyla,bh,CFrame.new(0,0.5,0))
  274. bh.Reflectance=0.1
  275. local blk=int('BlockMesh',bh)
  276. blk.Scale=Vector3.new(0.23,0.5,0.32)
  277. local bh2=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  278. weld(bh,bh2,CFrame.new(0,0.27,0.02)*ang(mr(16),0,0))
  279. bh2.Reflectance=0.1
  280. local blk=int('BlockMesh',bh2)
  281. blk.Scale=Vector3.new(0.23,0.2,0.32)
  282. local bh3=cp(tube,"Brown",Vector3.new(1,1,1))
  283. bh3.Material='Wood'
  284. weld(bh,bh3,CFrame.new(0,0.5,0.1)*ang(mr(20),0,0))
  285. local blk=int('BlockMesh',bh3)
  286. blk.Scale=Vector3.new(0.23,0.4,0.32)
  287. local bh4=cp(tube,"Really black",Vector3.new(1,1,1))
  288. weld(bh,bh4,CFrame.new(0,-0.1,0.27)*ang(0,0,0))
  289. local blk=int('BlockMesh',bh4)
  290. blk.Scale=Vector3.new(0.1,0.1,0.2)
  291. local bh5=cp(tube,"Really black",Vector3.new(1,1,1))
  292. weld(bh4,bh5,CFrame.new(0,0.06,0.06)*ang(0,0,0))
  293. local blk=int('BlockMesh',bh5)
  294. blk.Scale=Vector3.new(0.1,0.2,0.1)
  295. local bh5=cp(tube,"Really black",Vector3.new(1,1,1))
  296. weld(bh4,bh5,CFrame.new(0,0.3,0)*ang(mr(-20),0,0))
  297. local blk=int('BlockMesh',bh5)
  298. blk.Scale=Vector3.new(0.1,0.4,0.1)
  299.  
  300.  
  301.  
  302.  
  303. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  304. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.25,1.46,0.25)
  305. cyl.Reflectance=0.1
  306. weld(shaft,cyl,CFrame.new(-0.12,0.21,-0.37)*ang(mr(90),0,0))
  307. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  308. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.25,1.46,0.25)
  309. cyl.Reflectance=0.1
  310. weld(shaft,cyl,CFrame.new(0.12,0.21,-0.37)*ang(mr(90),0,0))
  311.  
  312. local cyl=cp(tube,"Really black",Vector3.new(1,1,1))
  313. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.18,1.48,0.18)
  314. cyl.Reflectance=0.1
  315. weld(shaft,cyl,CFrame.new(-0.12,0.21,-0.37)*ang(mr(90),0,0))
  316. local cyl=cp(tube,"Really black",Vector3.new(1,1,1))
  317. Instance.new("CylinderMesh",cyl).Scale=Vector3.new(0.18,1.48,0.18)
  318. cyl.Reflectance=0.1
  319. weld(shaft,cyl,CFrame.new(0.12,0.21,-0.37)*ang(mr(90),0,0))
  320.  
  321. local cyl1=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  322. Instance.new("BlockMesh",cyl1).Scale=Vector3.new(0.18,1.48,0.1)
  323. cyl.Reflectance=0.1
  324. weld(shaft,cyl1,CFrame.new(0,0.31,-0.37)*ang(mr(90),0,0))
  325.  
  326. local cylz=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  327. Instance.new("BlockMesh",cylz).Scale=Vector3.new(0.09,0.14,0.1)
  328. cylz.Reflectance=0.1
  329. weld(shaft,cylz,CFrame.new(0,0.37,-0.97)*ang(0,0,0))
  330.  
  331. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  332. Instance.new("BlockMesh",cyl).Scale=Vector3.new(0.05,0.14,0.1)
  333. cyl.Reflectance=0.1
  334. weld(shaft,cyl,CFrame.new(0.06,0.37,0.135)*ang(0,0,0))
  335. local cyl=cp(tube,"Dark stone grey",Vector3.new(1,1,1))
  336. Instance.new("BlockMesh",cyl).Scale=Vector3.new(0.05,0.14,0.1)
  337. cyl.Reflectance=0.1
  338. weld(shaft,cyl,CFrame.new(-0.06,0.37,0.135)*ang(0,0,0))
  339.  
  340. --[[local hn=cp(tube,"Dark stone grey",Vector3.new(0.2,0.7,0.2))
  341. hw=weld(ch.Head,hn,CFrame.new(0,4,0))
  342. Instance.new("CylinderMesh",hn)
  343.  
  344. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  345. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  346. weld(hn,rng,CFrame.new(0,0.3,0))
  347. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  348. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  349. weld(hn,rng,CFrame.new(0,0.2,0))
  350. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  351. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  352. weld(hn,rng,CFrame.new(0,0.1,0))
  353. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  354. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  355. weld(hn,rng,CFrame.new(0,0,0))
  356. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  357. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  358. weld(hn,rng,CFrame.new(0,-0.1,0))
  359. local rng=cp(tube,"Really black",Vector3.new(0.3,0.2,0.3))
  360. Instance.new("CylinderMesh",rng).Scale=Vector3.new(0.72,0.4,0.72)
  361. weld(hn,rng,CFrame.new(0,-0.2,0))]]
  362.  
  363.  
  364.  
  365.  
  366. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
  367. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
  368.  
  369. attacking=false
  370.  
  371. createBullet=function()
  372. local radz=math.random(math.random(8,11),math.random(12,15))
  373. local asd=m.Hit.lookVector
  374. local vel=Vector3.new(math.random(2,radz),math.random(1,radz),math.random(1,radz))+asd*350
  375. print'sn'
  376. local b=cp(tube,"Really black",Vector3.new(0.4,0.4,0.4))
  377. print'sn'
  378. local sp=int("SpecialMesh",b)
  379. sp.MeshType='Sphere'
  380. b.CFrame=cylz.CFrame
  381. b.Velocity=vel
  382. b.Touched:connect(function(p)
  383. if p.Parent:findFirstChild("Humanoid") then
  384. p.Parent.Humanoid:TakeDamage(100)
  385. b:Destroy()
  386. end
  387. end)
  388. end
  389.  
  390. loadBullet=function()
  391. Tween(lw,cfn(0,0.6,0)*ang(mr(-68),mr(60),0),0.2)
  392. click:Play()
  393. loaded=loaded+1
  394. ammo=ammo-1
  395. Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.2)
  396. end
  397.  
  398. m.Button1Down:connect(function()
  399. if attacking==false and loaded>0 then
  400. loaded=loaded-1
  401. attacking=true
  402. Spawn(function()
  403. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-55),mr(30),0),0.4)
  404. end)
  405. Tween(rw,cfn(0,0,0)*ang(mr(-55),mr(-30),0),0.4)
  406. for i=1,4 do
  407. createBullet()
  408. end
  409. local shell=cp(workspace,"Really red",Vector3.new(0.2,0.2,0.4))
  410. shell.Position=cyla.Position
  411. shoot:Play()
  412. Spawn(function()
  413. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.4)
  414. end)
  415. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.4)
  416. wait(0.1)
  417. attacking=false
  418. elseif attacking==false and loaded<=0 then
  419. attacking=true
  420. Tween(rw,cfn()*ang(mr(-65),mr(-30),0),0.4)
  421. Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.4)
  422. for i=1,6 do
  423. loadBullet()
  424. end
  425. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
  426. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
  427. attacking=false
  428. end
  429. end)
  430.  
  431. m.KeyDown:connect(function(k)
  432. if k=='r' and attacking==false then
  433. attacking=true
  434. Tween(rw,cfn()*ang(mr(-65),mr(-30),0),0.4)
  435. Tween(lw,cfn(0,0.6,0)*ang(mr(-60),mr(60),0),0.4)
  436. for i=1,6-loaded do
  437. loadBullet()
  438. end
  439. Tween(rw,cfn(0,0,0)*ang(mr(-45),mr(-30),0),0.3)
  440. Tween(lw,cfn(-0.2,0.7,0.7)*ang(mr(-45),mr(30),0),0.3)
  441. attacking=false
  442. end
  443. end)
Add Comment
Please, Sign In to add comment