Advertisement
Aeyao

123wertyuijhgdfsfhjjgfda

Feb 24th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.04 KB | None | 0 0
  1. wait(.5)
  2.  
  3. local event = Instance.new("RemoteEvent")
  4.  
  5. local localscript = NLS([[local p = game:GetService("Players").LocalPlayer
  6. local c = p.Character
  7. local cam = workspace.CurrentCamera
  8. local rp = c:WaitForChild("HumanoidRootPart")
  9. local humanoid = c:WaitForChild("Humanoid")
  10. local event = script:WaitForChild("RemoteEvent")
  11. local rs = game:GetService("RunService").RenderStepped
  12. local m = p:GetMouse()
  13. wait(1)
  14. for i,v in next,humanoid:GetPlayingAnimationTracks() do
  15. v:Stop()
  16. end
  17.  
  18. humanoid.WalkSpeed = 23
  19.  
  20. local uip = game:GetService("UserInputService")
  21. uip.InputBegan:connect(function(a,b)
  22. if not b then
  23. if a.UserInputType == Enum.UserInputType.MouseButton1 then
  24. event:FireServer("mouse",true)
  25. end
  26. if a.KeyCode == Enum.KeyCode.R then
  27. event:FireServer("switch")
  28. end
  29. if a.KeyCode == Enum.KeyCode.F then
  30. event:FireServer("hostile")
  31. end
  32. end
  33. end)
  34.  
  35. uip.InputEnded:connect(function(a,b)
  36. if not b then
  37. if a.UserInputType == Enum.UserInputType.MouseButton1 then
  38. event:FireServer("mouse",false)
  39. end
  40. end
  41. end)
  42.  
  43. event.OnClientEvent:connect(function(t,a)
  44. if t == "velocityforward" then
  45.  
  46. end
  47. end)
  48.  
  49. local bodygyro = Instance.new("BodyGyro",rp)
  50.  
  51. local state = "idle"
  52. local ostate = "idle"
  53.  
  54. rs:connect(function()
  55.  
  56. --local x,y,z = cam.CFrame:ToEulerAnglesXYZ()
  57. --bodygyro.MaxTorque = Vector3.new(0,999999,0)
  58. --bodygyro.CFrame = cam.CFrame
  59.  
  60. if state ~= ostate then
  61. event:FireServer("state",state)
  62. ostate = state
  63. end
  64.  
  65. local vel = rp.Velocity.magnitude
  66. if vel<.1 then
  67. state = "idle"
  68. else
  69. state = "walk"
  70. end
  71.  
  72. end)
  73. while wait(1/40) do
  74. event:FireServer("aimpos",m.Hit)
  75. end]],owner.Character)
  76. event.Parent = localscript
  77.  
  78. local gamestep = Instance.new("BindableEvent",script)
  79. gamestep.Name = "gamestep"
  80. local rs = game:GetService("RunService").Heartbeat
  81. framenum = 1/60
  82. cuframe = 0
  83.  
  84. rs:connect(function(s,p)
  85. cuframe = cuframe + s
  86. if cuframe > framenum then
  87. for i = 1,math.floor(cuframe/framenum) do
  88. gamestep:Fire()
  89. end
  90. cuframe = cuframe-framenum*math.floor(cuframe/framenum)
  91. end
  92. end)
  93.  
  94.  
  95. local p = game:GetService("Players"):WaitForChild("asbuff")
  96. repeat wait() until p.Character
  97. local c = p.Character
  98. local rarm = c["Right Arm"]
  99. local rp = c:WaitForChild("HumanoidRootPart")
  100. local humanoid = c:WaitForChild("Humanoid")
  101. local torso = c:WaitForChild("Torso")
  102.  
  103. local animation = {}
  104. do
  105. function animation.new(rig)
  106. local self = {}
  107. self.joints = {}
  108. self.cframes = {}
  109. self.origcframes = {}
  110. self.ucframes = {}
  111.  
  112. self.weight = .2
  113.  
  114. self.stopanimfunc = nil
  115.  
  116. for i,v in next,rig:GetChildren() do
  117. for i,joint in next,v:GetChildren() do
  118. if joint:IsA("Motor6D") then
  119. self.joints[joint.Part1.Name] = joint
  120. end
  121. end
  122. end
  123.  
  124. for i,v in next,self.joints do
  125. --print(i)
  126. end
  127.  
  128. function self:stop()
  129. self.stopanimfunc()
  130. end
  131. self.currentanim = ""
  132. function self:play(name,anim,loop,speed,weight,interupt,lop,func)
  133.  
  134. if self.currentanim == name and lop == true then
  135. --print("fooeds")
  136. return
  137. end
  138.  
  139. local anim = anim
  140. local starttime = tick()
  141. local stop = false
  142. local pause =false
  143. self.weight = weight
  144.  
  145. if interupt == true then
  146. if self.stopanimfunc ~= nil then
  147. self.stopanimfunc()
  148. end
  149. else
  150.  
  151. end
  152. self.currentanim = name
  153.  
  154. self.stopanimfunc = function()
  155. pause = true
  156. end
  157.  
  158. local timer = 0
  159.  
  160. local function leadstep()
  161. local kf = 0
  162. local smallesttime = 999
  163. local found = false
  164. local dtime = tick()-starttime
  165. timer = timer + (1/60)*speed
  166. dtime = timer
  167.  
  168. for i,v in next,anim do
  169. local ntime = 0
  170. if anim[i+1] then
  171. if anim[i+1].time then
  172. ntime = anim[i+1].time
  173. end
  174. else
  175. ntime = v.time
  176. end
  177.  
  178. if v.time < smallesttime and ntime > dtime then
  179. smallesttime = v.time
  180. kf = i
  181. found = true
  182. end
  183. end
  184.  
  185. if found == false then
  186. if loop then
  187. starttime = tick()
  188. timer = 0
  189. else
  190. stop = true
  191. end
  192. end
  193.  
  194. if pause == true then
  195. stop = true
  196. end
  197.  
  198. local keyframe = anim[kf]
  199. for name,v in next,self.joints do
  200. local sine = false
  201.  
  202. local cf = CFrame.new()
  203. local found = false
  204. if keyframe then
  205. for i,a in next,keyframe do
  206.  
  207. if i == name then
  208. if type(a) == "table" then
  209. local yes = a[2]()
  210. cf = a[1]*yes
  211. found = true
  212. else
  213. cf = a
  214. found = true
  215. end
  216. end
  217.  
  218. end
  219. end
  220.  
  221. if found == true then
  222.  
  223. self.cframes[name] = cf
  224.  
  225. end
  226.  
  227. end
  228.  
  229. end
  230.  
  231. local upd
  232. upd = rs:connect(function()
  233. leadstep()
  234. if stop == true then
  235. --print("stop")
  236. for i,v in next,self.cframes do
  237. --self.cframes[i]=CFrame.new()
  238. end
  239. func()
  240. upd:disconnect()
  241. end
  242. end)
  243.  
  244. return function() stop = true end
  245.  
  246. end
  247.  
  248. function self:step()
  249. for i,v in next,self.joints do
  250. if self.cframes[i] then
  251. if self.ucframes[i] == nil then self.ucframes[i] = CFrame.new() end
  252. self.ucframes[i] = self.ucframes[i]:lerp(self.cframes[i],self.weight)
  253. if self.origcframes[i] == nil then self.origcframes[i] = v.C0 end
  254.  
  255. v.C0 = self.origcframes[i] * self.ucframes[i]
  256. end
  257. end
  258. end
  259.  
  260. return self
  261. end
  262. end
  263.  
  264. local gun = Instance.new("Part")
  265. gun.Size = Vector3.new(1, 1, 1)
  266. gun.CanCollide = false
  267. local mesh = Instance.new("SpecialMesh",gun)
  268. mesh.MeshId = "rbxassetid://499544111"
  269. mesh.TextureId = "rbxassetid://499544129"
  270. mesh.Scale = Vector3.new(0.004, 0.004, 0.004)
  271. local gweld = Instance.new("Motor6D",rarm)
  272. gweld.Part0 = rarm
  273. gweld.Part1 = gun
  274. gun.Parent = c
  275.  
  276. local muzzle = Instance.new("Part")
  277. muzzle.Size = Vector3.new(.2,.2,.2)
  278. muzzle.CanCollide = false
  279. local mweld = Instance.new("Weld",gun)
  280. mweld.Part0 = gun
  281. mweld.Part1 = muzzle
  282. mweld.C0 = CFrame.new(0.9,.4,0)
  283. muzzle.Parent = gun
  284.  
  285. local maincol = Color3.fromRGB(128, 187, 219)
  286. ---
  287. local mf1 = Instance.new("ParticleEmitter")
  288. mf1.LightEmission = 1
  289. mf1.Size = NumberSequence.new({
  290. NumberSequenceKeypoint.new(0,1),
  291. NumberSequenceKeypoint.new(1,2.35),
  292. })
  293. mf1.Texture = "rbxassetid://1847258023"
  294. mf1.Transparency = NumberSequence.new({
  295. NumberSequenceKeypoint.new(0,1),
  296. NumberSequenceKeypoint.new(0.6,0),
  297. NumberSequenceKeypoint.new(1,1),
  298. })
  299. mf1.LockedToPart = true
  300. mf1.Lifetime = NumberRange.new(.2)
  301. mf1.Rate = 30
  302. mf1.Rotation = NumberRange.new(0,360)
  303. mf1.Enabled = false
  304. mf1.Speed = NumberRange.new(0)
  305. mf1.Parent = muzzle
  306. ---
  307. local mf2 = Instance.new("ParticleEmitter")
  308. mf2.LightEmission = 1
  309. mf2.Size = NumberSequence.new({
  310. NumberSequenceKeypoint.new(0,0),
  311. NumberSequenceKeypoint.new(0.5,0.1),
  312. NumberSequenceKeypoint.new(1,0),
  313. })
  314. mf2.Texture = "rbxassetid://156486182"
  315. mf2.Transparency = NumberSequence.new({
  316. NumberSequenceKeypoint.new(0,1),
  317. NumberSequenceKeypoint.new(0.6,0.7),
  318. NumberSequenceKeypoint.new(1,1),
  319. })
  320. mf2.LockedToPart = true
  321. mf2.Lifetime = NumberRange.new(.2)
  322. mf2.Rate = 30
  323. mf2.Rotation = NumberRange.new(0,360)
  324. mf2.Enabled = false
  325. mf2.Speed = NumberRange.new(10,20)
  326. mf2.SpreadAngle = Vector2.new(180,180)
  327. mf2.Parent = muzzle
  328. mf2.EmissionDirection = "Front"
  329. mf2.Drag = 20
  330.  
  331. local mf3 = Instance.new("ParticleEmitter")
  332. mf3.LightEmission = 1
  333. mf3.Size = NumberSequence.new({
  334. NumberSequenceKeypoint.new(0,1),
  335. NumberSequenceKeypoint.new(1,1.85),
  336. })
  337. mf3.Texture = "http://www.roblox.com/asset/?id=233113663"
  338. mf3.Transparency = NumberSequence.new({
  339. NumberSequenceKeypoint.new(0,1),
  340. NumberSequenceKeypoint.new(0.6,0),
  341. NumberSequenceKeypoint.new(1,1),
  342. })
  343. mf3.LockedToPart = true
  344. mf3.Lifetime = NumberRange.new(.04)
  345. mf3.Rate = 30
  346. mf3.Rotation = NumberRange.new(0,360)
  347. mf3.Enabled = false
  348. mf3.Speed = NumberRange.new(0)
  349. mf3.Parent = muzzle
  350.  
  351. ---
  352. mf2.Color = ColorSequence.new(maincol)
  353. mf3.Color = ColorSequence.new(maincol)
  354. mf1.Color = ColorSequence.new(maincol)
  355. --
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365. local whir = Instance.new("Sound",gun)
  366. whir.SoundId = "rbxassetid://394182767"
  367. whir.PlaybackSpeed = 1.4
  368. whir.Volume = 1
  369.  
  370. local laser = Instance.new("Sound",gun)
  371. laser.SoundId = "rbxassetid://1898322396"
  372. laser.PlaybackSpeed = 1
  373. laser.Volume = 1
  374.  
  375.  
  376. local laser2 = Instance.new("Sound",gun)
  377. laser2.SoundId = "rbxassetid://1202656211"
  378. laser2.PlaybackSpeed = 1
  379. laser2.Volume = 1
  380.  
  381. --
  382.  
  383.  
  384. local rig = animation.new(c)
  385.  
  386. local funcs = {}
  387.  
  388. local pointcf = CFrame.new()
  389.  
  390. function lookat(start,target)
  391.  
  392. local distance = (start.p-target.p).magnitude
  393. local offset = start:toObjectSpace(target)
  394. local x = math.atan2(offset.x,-offset.z)
  395.  
  396. local offset = (start * CFrame.Angles(0,-x,0)):toObjectSpace(target)
  397.  
  398. local y = math.atan2(offset.y,-offset.z)
  399.  
  400. return CFrame.Angles(0,-x,0)*CFrame.Angles(0,0,y+math.pi/2)--x,y,distance
  401. end
  402.  
  403. function lookat2(start,target)
  404.  
  405. local distance = (start.p-target.p).magnitude
  406. local offset = start:toObjectSpace(target)
  407. local x = math.atan2(offset.x,-offset.z)
  408.  
  409. local offset = (start * CFrame.Angles(0,-x,0)):toObjectSpace(target)
  410.  
  411. local y = math.atan2(offset.y,-offset.z)
  412.  
  413. return CFrame.Angles(0,0,-x)*CFrame.Angles(-y,0,0)
  414.  
  415. end
  416.  
  417. local recoil = CFrame.new()
  418.  
  419. local anims = {
  420. idle= {
  421. {
  422. ["Left Leg"] = {CFrame.new(-0.276043445, 0.201377928, 0, 0.988015771, -0.154352978, 0, 0.154352978, 0.988015771, 0, 0, 0, 1),function() return CFrame.new(0,-math.sin(tick())/9,0) end},
  423. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0) end},
  424. ["Right Arm"] = CFrame.new(0.110922299, -0.061678648, 0.0636402369, 0.901174605, -0.162362188, -0.40189901, 0.259175479, 0.945029497, 0.199366987, 0.347436816, -0.283826828, 0.893716872),
  425. ["Left Arm"] = CFrame.new(0, 2.98023224e-08, 0, 1, 0, 0, 0, 0.996509433, 0.0834799111, 0, -0.0834799111, 0.996509433),
  426. ["Part"] = CFrame.new(-0.233995408, -0.73597014, -0.575105429, 0.0200314447, -0.523180068, 0.851986706, -0.904473543, 0.353659719, 0.238437548, -0.426059067, -0.775375664, -0.466118187),
  427. ["Torso"] = {CFrame.new(0, -0.169919834, -0.163296893, 1, 0, 0, 0, 0.992978275, -0.11829678, 0, 0.11829678, 0.992978275)*CFrame.new(0,0,-.15),function() return CFrame.new(0,0,math.sin(tick())/9) end},
  428. ["Right Leg"] = {CFrame.new(0.212829798, 0.0396305323, 0, 0.961647749, -0.274287581, 0, 0.274287581, 0.961647749, 0, 0, 0, 1),function() return CFrame.new(0,-math.sin(tick())/9,0) end},
  429. ["time"] = 0.1,
  430. },
  431.  
  432. },
  433.  
  434. walk= {
  435.  
  436. {
  437. ["Left Leg"] = CFrame.new(-0.832244754, 0.735471427, 0, 0.943914652, 0.330189466, 0, -0.330189466, 0.943914652, 0, 0, 0, 1),
  438. ["Head"] = CFrame.new(4.65661287e-10, -1.3038516e-08, 0, 0.996589422, -0.0825192854, 0, 0.0823644698, 0.994719744, 0.0612255484, -0.00505228853, -0.061016731, 0.998123944),
  439. ["Right Arm"] = CFrame.new(0.110922113, -0.0616788566, 0.0636404157, 0.80436188, -0.437583208, -0.40189901, 0.543276906, 0.815538406, 0.199366987, 0.240524471, -0.378705651, 0.893716872),
  440. ["Left Arm"] = CFrame.new(2.98023224e-08, 5.96046448e-08, 0, 0.856122494, -0.516772985, 0, 0.51496917, 0.853134155, 0.0834799111, -0.0431401618, -0.0714690313, 0.996509433),
  441. ["Part"] = CFrame.new(-0.233995453, -0.73597002, -0.57510525, 0.0200314447, -0.523180068, 0.851986706, -0.904473543, 0.353659719, 0.238437548, -0.426059067, -0.775375664, -0.466118187),
  442. ["Torso"] = CFrame.new(1.86264515e-09, -0.169919834, -0.163296893, 0.992377043, 0.12323869, 0, -0.122373343, 0.985408843, -0.11829678, -0.014578741, 0.117395014, 0.992978275),
  443. ["Right Leg"] = CFrame.new(0, 0, 0, 0.775688052, 0.631116509, 0, -0.631116509, 0.775688052, 0, 0, 0, 1),
  444. ["time"] = 0,
  445. },
  446. {
  447. ["Left Leg"] = CFrame.new(-0.626752317, 0.152361274, 0, 0.904599249, 0.426262915, 0, -0.426262915, 0.904599249, 0, 0, 0, 1),
  448. ["Right Arm"] = CFrame.new(0.110922113, -0.0616788566, 0.0636404157, 0.80436188, -0.437583208, -0.40189901, 0.543276906, 0.815538406, 0.199366987, 0.240524471, -0.378705651, 0.893716872),
  449. ["time"] = 0.10000000149012,
  450. },
  451. {
  452. ["Right Leg"] = CFrame.new(0.935470343, -0.145744145, 0, 0.573149741, 0.819450617, 0, -0.819450617, 0.573149741, 0, 0, 0, 1),
  453. ["Torso"] = CFrame.new(0, -0.275256932, -0.260381281, 1, 0, 0, 0, 0.986370206, -0.164541662, 0, 0.164541662, 0.986370206),
  454. ["time"] = 0.25,
  455. ["Right Arm"] = CFrame.new(-0.189867541, -0.0872892439, -0.0630964339, 0.918714464, 0.00577605516, -0.394880086, 0.0782234967, 0.977420926, 0.196289182, 0.387097806, -0.211222619, 0.897518933),
  456. },
  457. {
  458. ["time"] = 0.34999999403954,
  459. ["Left Arm"] = CFrame.new(-1.1920929e-07, -8.94069672e-08, 1.78813934e-07, 0.762209237, 0.632005513, -0.140021756, -0.593523026, 0.768650293, 0.238552079, 0.258393973, -0.0987204164, 0.960982203),
  460. },
  461. {
  462. ["Left Leg"] = CFrame.new(-0.0431639552, -0.168072104, 0, 0.666396379, -0.745597661, 0, 0.745597661, 0.666396379, 0, 0, 0, 1),
  463. ["Right Arm"] = CFrame.new(0.110922217, -0.0616786182, 0.0636402667, 0.839134037, 0.367455184, -0.401037157, -0.311672837, 0.929087341, 0.19914031, 0.445773691, -0.042113021, 0.894154549),
  464. ["Head"] = CFrame.new(-3.37604433e-09, -7.4505806e-09, 0, 0.994075179, 0.108695045, -7.43893906e-07, -0.108491212, 0.992211699, 0.0612013899, 0.00665302714, -0.0608386956, 0.998125434),
  465. ["Torso"] = CFrame.new(0, -0.169919848, -0.163296893, 0.996150553, -0.0876595378, 0, 0.0870440304, 0.989155829, -0.11829678, 0.010369841, 0.1178414, 0.992978275),
  466. ["Right Leg"] = CFrame.new(0.648889005, 0.775551796, 0, 0.944947481, -0.32722193, 0, 0.32722193, 0.944947481, 0, 0, 0, 1),
  467. ["time"] = 0.40000000596046,
  468. },
  469. {
  470. ["time"] = 0.5,
  471. ["Right Arm"] = CFrame.new(0.110922217, -0.0616786182, 0.0636402667, 0.839134037, 0.367455184, -0.401037157, -0.311672837, 0.929087341, 0.19914031, 0.445773691, -0.042113021, 0.894154549),
  472. ["Left Arm"] = CFrame.new(-0.164686471, 0.0678058863, -0.0345693827, 0.90774864, 0.399867833, -0.126878306, -0.373744369, 0.908207536, 0.188345969, 0.190545335, -0.123550735, 0.973872542),
  473. },
  474. {
  475. ["time"] = 0.55000001192093,
  476. ["Right Leg"] = CFrame.new(0.327592164, 0.132180274, 0, 0.866657019, -0.498904556, 0, 0.498904556, 0.866657019, 0, 0, 0, 1),
  477. },
  478. {
  479. ["time"] = 0.60000002384186,
  480. ["Left Leg"] = CFrame.new(-0.843260288, -0.150004089, 0, 0.48957324, -0.87196213, 0, 0.87196213, 0.48957324, 0, 0, 0, 1),
  481. },
  482. {
  483. ["Torso"] = CFrame.new(0, -0.258102387, -0.363217384, 1, 0, 0, 0, 0.986370206, -0.164541662, 0, 0.164541662, 0.986370206),
  484. ["time"] = 0.64999997615814,
  485. ["Right Arm"] = CFrame.new(0.380866587, -0.0053589642, 0.170066118, 0.913265884, -0.100147665, -0.394861788, 0.190538883, 0.961758077, 0.196764603, 0.360056013, -0.254934937, 0.89742291),
  486. },
  487. {
  488. ["Left Leg"] = CFrame.new(-0.832244754, 0.735471427, 0, 0.943914652, 0.330189466, 0, -0.330189466, 0.943914652, 0, 0, 0, 1),
  489. ["Head"] = CFrame.new(4.65661287e-10, -1.3038516e-08, 0, 0.996589422, -0.0825192854, 0, 0.0823644698, 0.994719744, 0.0612255484, -0.00505228853, -0.061016731, 0.998123944),
  490. ["Right Arm"] = CFrame.new(0.110922113, -0.0616788566, 0.0636404157, 0.80436188, -0.437583208, -0.40189901, 0.543276906, 0.815538406, 0.199366987, 0.240524471, -0.378705651, 0.893716872),
  491. ["Left Arm"] = CFrame.new(2.98023224e-08, 5.96046448e-08, 0, 0.856122494, -0.516772985, 0, 0.51496917, 0.853134155, 0.0834799111, -0.0431401618, -0.0714690313, 0.996509433),
  492. ["Part"] = CFrame.new(-0.233995453, -0.73597002, -0.57510525, 0.0200314447, -0.523180068, 0.851986706, -0.904473543, 0.353659719, 0.238437548, -0.426059067, -0.775375664, -0.466118187),
  493. ["Torso"] = CFrame.new(1.86264515e-09, -0.169919834, -0.163296893, 0.992377043, 0.12323869, 0, -0.122373343, 0.985408843, -0.11829678, -0.014578741, 0.117395014, 0.992978275),
  494. ["Right Leg"] = CFrame.new(0, 0, 0, 0.775688052, 0.631116509, 0, -0.631116509, 0.775688052, 0, 0, 0, 1),
  495. ["time"] = 0.80000001192093,
  496. },
  497. },
  498.  
  499.  
  500. idleaim= {
  501. {
  502. ["Left Leg"] = {CFrame.new(-0.276043445, 0.201377928, 0, 0.988015771, -0.154352978, 0, 0.154352978, 0.988015771, 0, 0, 0, 1),function() return CFrame.new(0,-math.sin(tick())/9,0) end},
  503. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
  504. ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
  505. ["Left Arm"] = CFrame.new(0, 2.98023224e-08, 0, 1, 0, 0, 0, 0.996509433, 0.0834799111, 0, -0.0834799111, 0.996509433),
  506. ["Part"] = CFrame.Angles(0,math.pi/2,-math.pi/2)*CFrame.new(1.2,.3,0),
  507. ["Torso"] = {CFrame.new(0, -0.169919834, -0.163296893, 1, 0, 0, 0, 0.992978275, -0.11829678, 0, 0.11829678, 0.992978275)*CFrame.Angles(math.rad(-2),0,math.rad(20))*CFrame.new(0,0,-.15),function() return CFrame.new(0,0,math.sin(tick())/9) end},
  508. ["Right Leg"] = {CFrame.new(0.212829798, 0.0396305323, 0, 0.961647749, -0.274287581, 0, 0.274287581, 0.961647749, 0, 0, 0, 1),function() return CFrame.new(0,-math.sin(tick())/9,0) end},
  509. ["time"] = 0.1,
  510. },
  511.  
  512. },
  513. walkaim= {
  514.  
  515. {
  516. ["Left Leg"] = CFrame.new(-0.832244754, 0.735471427, 0, 0.943914652, 0.330189466, 0, -0.330189466, 0.943914652, 0, 0, 0, 1),
  517. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
  518. ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
  519. ["Left Arm"] = CFrame.new(2.98023224e-08, 5.96046448e-08, 0, 0.856122494, -0.516772985, 0, 0.51496917, 0.853134155, 0.0834799111, -0.0431401618, -0.0714690313, 0.996509433),
  520. ["Part"] = CFrame.Angles(0,math.pi/2,-math.pi/2)*CFrame.new(1.2,.3,0),
  521. ["Torso"] = CFrame.new(1.86264515e-09, -0.169919834, -0.163296893, 0.992377043, 0.12323869, 0, -0.122373343, 0.985408843, -0.11829678, -0.014578741, 0.117395014, 0.992978275),
  522. ["Right Leg"] = CFrame.new(0, 0, 0, 0.775688052, 0.631116509, 0, -0.631116509, 0.775688052, 0, 0, 0, 1),
  523. ["time"] = 0,
  524. },
  525. {
  526. ["Left Leg"] = CFrame.new(-0.626752317, 0.152361274, 0, 0.904599249, 0.426262915, 0, -0.426262915, 0.904599249, 0, 0, 0, 1),
  527. ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
  528. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
  529.  
  530. ["time"] = 0.10000000149012,
  531. },
  532. {
  533. ["Right Leg"] = CFrame.new(0.935470343, -0.145744145, 0, 0.573149741, 0.819450617, 0, -0.819450617, 0.573149741, 0, 0, 0, 1),
  534. ["Torso"] = CFrame.new(0, -0.275256932, -0.260381281, 1, 0, 0, 0, 0.986370206, -0.164541662, 0, 0.164541662, 0.986370206),
  535. ["time"] = 0.25,
  536. ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
  537. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
  538.  
  539. },
  540. {
  541. ["time"] = 0.34999999403954,
  542. ["Left Arm"] = CFrame.new(-1.1920929e-07, -8.94069672e-08, 1.78813934e-07, 0.762209237, 0.632005513, -0.140021756, -0.593523026, 0.768650293, 0.238552079, 0.258393973, -0.0987204164, 0.960982203),
  543. ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
  544. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
  545.  
  546. },
  547. {
  548. ["Left Leg"] = CFrame.new(-0.0431639552, -0.168072104, 0, 0.666396379, -0.745597661, 0, 0.745597661, 0.666396379, 0, 0, 0, 1),
  549. ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
  550. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
  551. ["Torso"] = CFrame.new(0, -0.169919848, -0.163296893, 0.996150553, -0.0876595378, 0, 0.0870440304, 0.989155829, -0.11829678, 0.010369841, 0.1178414, 0.992978275),
  552. ["Right Leg"] = CFrame.new(0.648889005, 0.775551796, 0, 0.944947481, -0.32722193, 0, 0.32722193, 0.944947481, 0, 0, 0, 1),
  553. ["time"] = 0.40000000596046,
  554. },
  555. {
  556. ["time"] = 0.5,
  557. ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
  558. ["Left Arm"] = CFrame.new(-0.164686471, 0.0678058863, -0.0345693827, 0.90774864, 0.399867833, -0.126878306, -0.373744369, 0.908207536, 0.188345969, 0.190545335, -0.123550735, 0.973872542),
  559. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
  560.  
  561. },
  562. {
  563. ["time"] = 0.55000001192093,
  564. ["Right Leg"] = CFrame.new(0.327592164, 0.132180274, 0, 0.866657019, -0.498904556, 0, 0.498904556, 0.866657019, 0, 0, 0, 1),
  565. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
  566.  
  567. },
  568. {
  569. ["time"] = 0.60000002384186,
  570. ["Left Leg"] = CFrame.new(-0.843260288, -0.150004089, 0, 0.48957324, -0.87196213, 0, 0.87196213, 0.48957324, 0, 0, 0, 1),
  571. ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
  572. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
  573.  
  574. },
  575. {
  576. ["Torso"] = CFrame.new(0, -0.258102387, -0.363217384, 1, 0, 0, 0, 0.986370206, -0.164541662, 0, 0.164541662, 0.986370206),
  577. ["time"] = 0.64999997615814,
  578. ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
  579. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
  580.  
  581. },
  582. {
  583. ["Left Leg"] = CFrame.new(-0.832244754, 0.735471427, 0, 0.943914652, 0.330189466, 0, -0.330189466, 0.943914652, 0, 0, 0, 1),
  584. ["Head"] = {CFrame.new(0, 0, 0, 1, 0, 0, 0, 0.998123944, 0.0612255484, 0, -0.0612255484, 0.998123944),function() return CFrame.Angles(math.cos(tick())/13,0,0)*lookat2(torso.CFrame*CFrame.new(0,1.5,0),pointcf) end},
  585. ["Right Arm"] = {CFrame.new(0,0,0),function() return lookat(torso.CFrame*CFrame.new(-1,.5,0),pointcf)*recoil end},
  586. ["Left Arm"] = CFrame.new(2.98023224e-08, 5.96046448e-08, 0, 0.856122494, -0.516772985, 0, 0.51496917, 0.853134155, 0.0834799111, -0.0431401618, -0.0714690313, 0.996509433),
  587. ["Part"] = CFrame.Angles(0,math.pi/2,-math.pi/2)*CFrame.new(1.2,.3,0),
  588. ["Torso"] = CFrame.new(1.86264515e-09, -0.169919834, -0.163296893, 0.992377043, 0.12323869, 0, -0.122373343, 0.985408843, -0.11829678, -0.014578741, 0.117395014, 0.992978275),
  589. ["Right Leg"] = CFrame.new(0, 0, 0, 0.775688052, 0.631116509, 0, -0.631116509, 0.775688052, 0, 0, 0, 1),
  590. ["time"] = 0.80000001192093,
  591. },
  592. },
  593. }
  594.  
  595. local mouse = {mouse1=false,hit=CFrame.new()}
  596.  
  597. local shoot = {}
  598. do
  599. local bullets = {}
  600. function shoot.bullet(b)
  601. local self = {}
  602. local h,p,r
  603. local ignore = {c}
  604. local cpos = muzzle.CFrame.p
  605. local parts = {}
  606. local reps = 0
  607. local rotoff = Vector3.new()
  608.  
  609. local sound = laser:Clone()
  610. sound.Parent = muzzle
  611. sound:Play()
  612. game.Debris:AddItem(sound,1)
  613. mf3:Emit(4)
  614.  
  615. recoil = CFrame.new(0,0.3,0)
  616.  
  617. local id = math.random(2135225,435223464)
  618. --bullets[id]=self
  619. --function self:step()
  620. rotoff = rotoff + Vector3.new(0,-.003,0)
  621. reps = reps + 1
  622. h,p,r = workspace:FindPartOnRayWithIgnoreList(Ray.new(
  623. cpos,
  624. ((CFrame.new(muzzle.CFrame.p,b.p).lookVector)+(rotoff))*999
  625. ),ignore)
  626.  
  627. --laser
  628. local dist = (cpos-p).magnitude
  629. local laser = Instance.new("Part")
  630. laser.Color = maincol
  631. laser.Material = "Neon"
  632. laser.Size = Vector3.new(.4,.4,dist)
  633. laser.CFrame = CFrame.new(cpos,p)*CFrame.new(0,0,-dist/2)
  634. laser.Anchored = true
  635. laser.CanCollide = false
  636. laser.Parent = c
  637. game.Debris:AddItem(laser,.02)
  638.  
  639. if h then
  640.  
  641. end
  642.  
  643. cpos = p
  644. --rs:wait()
  645. if reps > 100 then
  646. --bullets[id]=nil
  647. end
  648. if h ~= nil then
  649.  
  650. if h.Parent:FindFirstChildOfClass("Humanoid") then
  651. local hum = h.Parent:FindFirstChildOfClass("Humanoid")
  652. hum.Health = 0
  653. h:BreakJoints()
  654. end
  655.  
  656. --bullets[id]=nil
  657. --[[delay(0,function()
  658. local explosion = Instance.new("Explosion")
  659. explosion.Visible =false
  660. explosion.BlastRadius = 1
  661. explosion.BlastPressure = 0
  662. explosion.Position = p
  663. explosion.Parent = workspace
  664.  
  665. local lol = explosion.Hit:connect(function(h)
  666. if h.Parent:FindFirstChildOfClass("Humanoid") and h.Parent ~= c then
  667. local hum = h.Parent:FindFirstChildOfClass("Humanoid")
  668. hum.Health = 0
  669. h:BreakJoints()
  670. end
  671. end)
  672. wait(1)
  673. lol:disconnect()
  674. end)]]
  675. end
  676.  
  677. end
  678.  
  679. function shoot.lightning(b)
  680. local h,p,r
  681. local ignore = {c}
  682. local cpos = muzzle.CFrame.p
  683. local parts = {}
  684. local reps = 0
  685. local rotoff = Vector3.new()
  686.  
  687. local sound = laser2:Clone()
  688. sound.Parent = muzzle
  689. sound:Play()
  690. game.Debris:AddItem(sound,1)
  691.  
  692. mf1:Emit(4)
  693. mf2:Emit(4)
  694.  
  695. repeat
  696. rotoff = Vector3.new(math.random(-100,100),math.random(-100,100),math.random(-100,100))/1300
  697. reps = reps + 1
  698. h,p,r = workspace:FindPartOnRayWithIgnoreList(Ray.new(
  699. cpos,
  700. ((CFrame.new(muzzle.CFrame.p,b.p).lookVector)+(rotoff))*12
  701. ),ignore)
  702.  
  703. --laser
  704. local dist = (cpos-p).magnitude
  705. local laser = Instance.new("Part")
  706. laser.Color = maincol
  707. laser.Material = "Neon"
  708. laser.Size = Vector3.new(.4,.4,dist)
  709. laser.CFrame = CFrame.new(cpos,p)*CFrame.new(0,0,-dist/2)
  710. laser.Anchored = true
  711. laser.CanCollide = false
  712. laser.Parent = c
  713. parts[#parts+1]=laser
  714.  
  715.  
  716. if h then
  717.  
  718. end
  719.  
  720. cpos = p
  721. until h ~= nil or reps > 10
  722.  
  723. for i,v in next,parts do
  724. game.Debris:AddItem(v,.03)
  725. end
  726.  
  727. local explosion = Instance.new("Explosion")
  728. explosion.Visible =false
  729. explosion.BlastRadius = 1
  730. explosion.BlastPressure = 0
  731. explosion.Position = p
  732. explosion.Parent = workspace
  733.  
  734. explosion.Hit:connect(function(h)
  735. if h.Parent:FindFirstChildOfClass("Humanoid") and h.Parent ~= c then
  736. local hum = h.Parent:FindFirstChildOfClass("Humanoid")
  737. hum.Health = 0
  738. h:BreakJoints()
  739. end
  740. end)
  741.  
  742. end
  743. end
  744.  
  745. event.OnServerEvent:connect(function(p,fn,...)
  746. funcs[fn](...)
  747. end)
  748. c.Animate:Destroy()
  749.  
  750. local firing = false
  751. local state = "idle"
  752.  
  753. funcs.state = function(ste)
  754. state = ste
  755. end
  756. funcs.aimpos = function(pos)
  757. pointcf = pos
  758. mouse.hit = pos
  759. end
  760. funcs.mouse = function(on)
  761. mouse.mouse1 = on
  762. end
  763. --wait(.3)
  764. local hostile = false
  765.  
  766. local rate = 0
  767.  
  768. local ammo = 1
  769.  
  770. funcs.switch = function()
  771. rate = 0
  772. ammo = ammo + 1
  773. if ammo >= 3 then
  774. ammo = 1
  775. end
  776. end
  777. local ostate = state
  778. funcs.hostile = function()
  779. hostile = not hostile
  780. ostate = "none"
  781. end
  782.  
  783. gamestep.Event:connect(function()
  784. if hostile == true then
  785. if state ~= ostate then
  786. if state == "idle" then
  787.  
  788. rig:play("idleh",anims.idleaim,true,2,.4,true,true,function() end)
  789. ostate = state
  790. elseif state == "walk" then
  791. rig:play("walkh",anims.walkaim,true,1.5,.14,true,true,function() end)
  792. ostate = state
  793. end
  794. end
  795. else
  796. if state ~= ostate then
  797. if state == "idle" then
  798.  
  799. rig:play("idle",anims.idle,true,2,.4,true,true,function() end)
  800. ostate = state
  801. elseif state == "walk" then
  802. rig:play("walk",anims.walk,true,1.5,.14,true,true,function() end)
  803. ostate = state
  804. end
  805. end
  806. end
  807. mf2.Color = ColorSequence.new(maincol)
  808. mf3.Color = ColorSequence.new(maincol)
  809. mf1.Color = ColorSequence.new(maincol)
  810. recoil=recoil:Lerp(CFrame.new(),.2)
  811. if hostile == true then
  812. if mouse.mouse1 == true then
  813. if ammo == 1 then
  814. maincol = Color3.fromRGB(128, 187, 219)
  815. if rate<tick() then
  816. rate = tick()+.08
  817. shoot.lightning(mouse.hit)
  818. end
  819. elseif ammo == 2 then
  820. maincol = Color3.fromRGB(218, 137, 117)
  821. if rate<tick() then
  822. rate = tick()+.09
  823. spawn(function()
  824. shoot.bullet(mouse.hit)
  825. end)
  826. end
  827. end
  828. else
  829.  
  830. end
  831. end
  832. rig:step()
  833. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement