TheProNoob2004

Aleksa Animations [By: TheProNoob2004]

Jun 20th, 2016
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.69 KB | None | 0 0
  1. plr = game:FindService'Players'.LocalPlayer
  2. char = plr.Character
  3. for i,v in pairs(plr:children()) do
  4. if v.Name == 'Coach' or v.Name == 'Rochelle' or v.Name == 'Ellis' or v.Name == 'Nick' then
  5. v:remove()
  6. end
  7. end
  8. if char:FindFirstChild'Animate' then
  9. char:FindFirstChild'Animate':remove()
  10. wait(0.1)
  11. end
  12. function ClearNotNeededStuff(parent)
  13. for i,v in pairs(parent:children()) do
  14. if v.ClassName == 'CharacterMesh' or v.ClassName == 'Hat' or v.ClassName == 'Shirt' or v.ClassName == 'Pants' or (v.ClassName == 'Decal' and v.Name ~= 'face') then
  15. v:remove()
  16. else
  17. ClearNotNeededStuff(v)
  18. end
  19. end
  20. end
  21. function getVelocity(p1,p2,speed)
  22. local dis=(p1-p2).magnitude
  23. if speed=="dis" then
  24. if dis*6>100 then
  25. speed=dis*6
  26. else
  27. speed=100
  28. end
  29. end
  30. local x=(p1.x-p2.x)/dis*speed
  31. local y=(p1.y-p2.y)/dis*speed
  32. local z=(p1.z-p2.z)/dis*speed
  33. return Vector3.new(-x,-y+10,-z)
  34. end
  35. ClearNotNeededStuff(char)
  36. ControllerService = game:GetService("ControllerService")
  37. Controllers = ControllerService:GetChildren()[1]
  38. mouse = plr:GetMouse()
  39. humanoid = char:findFirstChild("Humanoid")
  40. torso = char:findFirstChild("Torso")
  41. head = char.Head
  42. ra = char:findFirstChild("Right Arm")
  43. la = char:findFirstChild("Left Arm")
  44. rl = char:findFirstChild("Right Leg")
  45. ll = char:findFirstChild("Left Leg")
  46. rs = torso:findFirstChild("Right Shoulder")
  47. ls = torso:findFirstChild("Left Shoulder")
  48. rh = torso:findFirstChild("Right Hip")
  49. lh = torso:findFirstChild("Left Hip")
  50. neck = torso:findFirstChild("Neck")
  51. rj = char:findFirstChild("HumanoidRootPart"):findFirstChild("RootJoint")
  52. rootpart = char:findFirstChild("HumanoidRootPart")
  53. backpack = plr:FindFirstChild'Backpack'
  54. PlayerGui = plr:FindFirstChild'PlayerGui'
  55. MainScreenGui = Instance.new("ScreenGui",PlayerGui)
  56. MainFrame = Instance.new("Frame",MainScreenGui)
  57. MainFrame.Size = UDim2.new(0.2, 0,0.1, 0)
  58. MainFrame.Position = UDim2.new(0.79, 0,0.4, 0)
  59. MainFrame.BorderSizePixel = 0
  60. MainFrame.BackgroundColor3 = BrickColor.new'Institutional white'.Color
  61. GunNameTextLabel = Instance.new("TextLabel",MainFrame)
  62. GunNameTextLabel.BackgroundTransparency = 1
  63. GunNameTextLabel.Size = UDim2.new(1,0,0.5,0)
  64. GunNameTextLabel.Font = 'Legacy'
  65. GunNameTextLabel.TextScaled = true
  66. GunNameTextLabel.Text = 'Current weapon: None'
  67. AmmoTextLabel = Instance.new("TextLabel",MainFrame)
  68. AmmoTextLabel.BackgroundTransparency = 1
  69. AmmoTextLabel.Size = UDim2.new(1,0,0.5,0)
  70. AmmoTextLabel.Position = UDim2.new(0,0,0.5,0)
  71. AmmoTextLabel.Font = 'Legacy'
  72. AmmoTextLabel.TextScaled = true
  73. AmmoTextLabel.Text = 'Ammo amount: No weapon'
  74. pcall(function()
  75. game:FindService'Lighting':FindFirstChild'Pistol':Clone().Parent=backpack
  76. end)
  77. camera = workspace.CurrentCamera
  78. local climbing = false
  79. local rm = Instance.new("Motor", torso)
  80. rm.C0 = CFrame.new(1.5, 0.5, 0)
  81. rm.C1 = CFrame.new(0, 0.5, 0)
  82. rm.Part0 = torso
  83. rm.Part1 = ra
  84. rm.Name = "Right Shoulder"
  85.  
  86. local lm = Instance.new("Motor", torso)
  87. lm.C0 = CFrame.new(-1.5, 0.5, 0)
  88. lm.C1 = CFrame.new(0, 0.5, 0)
  89. lm.Part0 = torso
  90. lm.Part1 = la
  91. lm.Name = "Left Shoulder"
  92.  
  93. local rlegm = Instance.new("Motor", torso)
  94. rlegm.C0 = CFrame.new(0.5, -1, 0)
  95. rlegm.C1 = CFrame.new(0, 1, 0)
  96. rlegm.Part0 = torso
  97. rlegm.Part1 = rl
  98. rlegm.Name = "Right Hip"
  99.  
  100. local llegm = Instance.new("Motor", torso)
  101. llegm.C0 = CFrame.new(-0.5, -1, 0)
  102. llegm.C1 = CFrame.new(0, 1, 0)
  103. llegm.Part0 = torso
  104. llegm.Part1 = ll
  105. llegm.Name = "Left Hip"
  106.  
  107. neck.C0 = CFrame.new(0, 1, 0)
  108. neck.C1 = CFrame.new(0, -0.5, 0)
  109.  
  110. rj.C0 = CFrame.new(0, -1.5, 0)
  111. rj.C1 = CFrame.new(0, -1.5, 0)
  112.  
  113. rsc0 = rm.C0
  114. lsc0 = lm.C0
  115. llc0 = llegm.C0
  116. rlc0 = rlegm.C0
  117. neckc0 = neck.C0
  118. rootc0 = rj.C0
  119.  
  120. local angle = 0
  121. local anglespeed = 8
  122. local count = 0
  123. local countspeed = 16
  124. local action = 'none'
  125. local lastaction = 'none'
  126. local dancingtime = 0
  127. local idletime = 0
  128. local will_lay = false
  129. local hmesh = head:FindFirstChild'Mesh'
  130. hmesh:remove()
  131. hmesh = Instance.new('SpecialMesh',head)
  132. hmesh.Scale = Vector3.new(1.25, 1.25, 1.25)
  133. hmesh.MeshType = 'Head'
  134.  
  135. local notUsedPlayers = {
  136. ['Nick'] = 'notused',
  137. ['Rochelle'] = 'notused',
  138. ['Coach'] = 'notused',
  139. ['Ellis'] = 'notused'
  140. }
  141. local availablePlayerNames = {'Nick','Rochelle','Coach','Ellis'}
  142. function GetNotUsedPlayers()
  143. for i,v in pairs(game:FindService'Players':players()) do
  144. for j,k in pairs(notUsedPlayers) do
  145. if v:FindFirstChild(j) then
  146. notUsedPlayers[j] = 'used'
  147. end
  148. end
  149. end
  150. end
  151. GetNotUsedPlayers()
  152. local currentPlayer = nil
  153. for i,v in pairs(availablePlayerNames) do
  154. if currentPlayer ~= nil then break end
  155. if notUsedPlayers[v] == 'notused' then
  156. currentPlayer = v
  157. end
  158. end
  159.  
  160. local asd = Instance.new("StringValue",plr)
  161. asd.Name = currentPlayer
  162.  
  163. pcall(function()
  164. head.face.Texture = 'rbxasset://textures/face.png'
  165. end)
  166.  
  167. rbxutil = LoadLibrary'RbxUtility'
  168. onToolSelected = rbxutil.CreateSignal()
  169.  
  170. ToolSelected = nil
  171.  
  172. for i,v in pairs(backpack:children()) do
  173. if v.ClassName == 'Tool' then
  174. if v:FindFirstChild'Handle' then
  175. v.Equipped:connect(function()
  176. onToolSelected:fire('selected',v)
  177. ToolSelected = v
  178. end)
  179. v.Unequipped:connect(function()
  180. onToolSelected:fire('unselected',v)
  181. ToolSelected = nil
  182. end)
  183. end
  184. end
  185. end
  186.  
  187. backpack.ChildAdded:connect(function(what)
  188. if what.ClassName == 'Tool' then
  189. if what:FindFirstChild'Handle' then
  190. what.Equipped:connect(function()
  191. onToolSelected:fire('selected',what)
  192. ToolSelected = what
  193. end)
  194. what.Unequipped:connect(function()
  195. onToolSelected:fire('unselected',what)
  196. ToolSelected = nil
  197. end)
  198. end
  199. end
  200. end)
  201.  
  202. currentShootConnection = nil
  203. MaxAmmuntition = {} --ye, spell mistake, don't judge it
  204.  
  205. onToolSelected:connect(function(a,b)
  206. if a == 'selected' then
  207. if MaxAmmuntition[b.Name] == nil then
  208. MaxAmmuntition[b.Name] = b:FindFirstChild'Ammo'.Value
  209. end
  210. GunNameTextLabel.Text = 'Current weapon: '..b.Name
  211. AmmoTextLabel.Text = 'Ammo amount: '..b:FindFirstChild'Ammo'.Value or 'Ammo amount: No ammo'
  212. currentShootConnection = b.Activated:connect(function()
  213. if b:FindFirstChild'Ammo'.Value > 0 then
  214. b:FindFirstChild'Ammo'.Value = b:FindFirstChild'Ammo'.Value-1
  215. AmmoTextLabel.Text = 'Ammo amount: '..b:FindFirstChild'Ammo'.Value or 'Ammo amount: No ammo'
  216. local bullet = Instance.new("Part",workspace)
  217. bullet.Name = 'Bullet'
  218. bullet.TopSurface = 0
  219. bullet.BottomSurface = 0
  220. bullet.FormFactor = 'Custom'
  221. bullet.CFrame = b:FindFirstChild'Handle'.CFrame
  222. bullet.CanCollide = false
  223. bullet.Velocity = getVelocity(bullet.Position, mouse.Hit.p, 500)
  224. local bulletmesh = b:FindFirstChild'BulletMesh':Clone()
  225. bulletmesh.Parent=bullet
  226. bullet.Touched:connect(function(toucher)
  227. if toucher.Parent:findFirstChild'Head' and toucher.Parent:findFirstChild'Torso' and toucher.Parent.Name ~= plr.Name then
  228. bullet:remove()
  229. for i,v in pairs(toucher.Parent:children()) do
  230. if v.ClassName == 'Humanoid' then
  231. if v.Health > 100 then
  232. v.Health = 100
  233. else
  234. v.Health = v.Health - math.random(b:FindFirstChild'MinDamage'.Value,b:FindFirstChild'MaxDamage'.Value)
  235. end
  236. end
  237. end
  238. end
  239. end)
  240. else
  241. action = 'reloading'
  242. end
  243. end)
  244. else
  245. GunNameTextLabel.Text = 'Current weapon: None'
  246. AmmoTextLabel.Text = 'Ammo amount: No weapon'
  247. pcall(function()
  248. currentShootConnection:disconnect()
  249. end)
  250. end
  251. end)
  252.  
  253. local fakehead = head:clone()
  254. fakehead.Parent = char
  255. fakehead.TopSurface = 'SmoothNoOutlines'
  256. fakehead.BottomSurface = 'SmoothNoOutlines'
  257. fakehead.RightSurface = 'SmoothNoOutlines'
  258. fakehead.LeftSurface = 'SmoothNoOutlines'
  259. fakehead.FrontSurface = 'SmoothNoOutlines'
  260. fakehead.BackSurface = 'SmoothNoOutlines'
  261. fakehead.BrickColor = currentPlayer=='Rochelle' and BrickColor.new'Brown' or currentPlayer == 'Nick' and BrickColor.new'Pastel brown' or currentPlayer=='Ellis' and BrickColor.new'Pastel brown' or currentPlayer=='Coach' and BrickColor.new'Brown'
  262. fakehead.Name = 'FakeHead'
  263. head.Transparency = 1
  264. local faketorso = torso:clone()
  265. faketorso.Parent = char
  266. faketorso.Name = 'FakeTorso'
  267. faketorso.TopSurface = 'SmoothNoOutlines'
  268. faketorso.BottomSurface = 'SmoothNoOutlines'
  269. faketorso.RightSurface = 'SmoothNoOutlines'
  270. faketorso.LeftSurface = 'SmoothNoOutlines'
  271. faketorso.FrontSurface = 'SmoothNoOutlines'
  272. faketorso.BackSurface = 'SmoothNoOutlines'
  273. faketorso.BrickColor = currentPlayer=='Rochelle' and BrickColor.new'Hot pink' or currentPlayer == 'Nick' and BrickColor.new'Institutional white' or currentPlayer=='Ellis' and BrickColor.new'White' or currentPlayer=='Coach' and BrickColor.new'Medium green'
  274. torso.Transparency = 1
  275. local fakela = la:Clone()
  276. fakela.Parent = char
  277. fakela.TopSurface = 'SmoothNoOutlines'
  278. fakela.BottomSurface = 'SmoothNoOutlines'
  279. fakela.RightSurface = 'SmoothNoOutlines'
  280. fakela.LeftSurface = 'SmoothNoOutlines'
  281. fakela.FrontSurface = 'SmoothNoOutlines'
  282. fakela.BackSurface = 'SmoothNoOutlines'
  283. fakela.BrickColor = currentPlayer=='Rochelle' and BrickColor.new'Brown' or currentPlayer == 'Nick' and BrickColor.new'Institutional white' or currentPlayer=='Ellis' and BrickColor.new'Pastel brown' or currentPlayer=='Coach' and BrickColor.new'Brown'
  284. fakela.Name = 'FakeLeft Arm'
  285. la.Transparency = 1
  286. local fakera = ra:Clone()
  287. fakera.Parent = char
  288. fakera.TopSurface = 'SmoothNoOutlines'
  289. fakera.BottomSurface = 'SmoothNoOutlines'
  290. fakera.RightSurface = 'SmoothNoOutlines'
  291. fakera.LeftSurface = 'SmoothNoOutlines'
  292. fakera.FrontSurface = 'SmoothNoOutlines'
  293. fakera.BackSurface = 'SmoothNoOutlines'
  294. fakera.BrickColor = currentPlayer=='Rochelle' and BrickColor.new'Brown' or currentPlayer == 'Nick' and BrickColor.new'Institutional white' or currentPlayer=='Ellis' and BrickColor.new'Pastel brown' or currentPlayer=='Coach' and BrickColor.new'Brown'
  295. fakera.Name = 'FakeRight Arm'
  296. ra.Transparency = 1
  297. local fakerl = rl:Clone()
  298. fakerl.Parent = char
  299. fakerl.TopSurface = 'SmoothNoOutlines'
  300. fakerl.BottomSurface = 'SmoothNoOutlines'
  301. fakerl.RightSurface = 'SmoothNoOutlines'
  302. fakerl.LeftSurface = 'SmoothNoOutlines'
  303. fakerl.FrontSurface = 'SmoothNoOutlines'
  304. fakerl.BackSurface = 'SmoothNoOutlines'
  305. fakerl.BrickColor = currentPlayer=='Rochelle' and BrickColor.new'Black' or currentPlayer == 'Nick' and BrickColor.new'Institutional white' or currentPlayer=='Ellis' and BrickColor.new'Really black' or currentPlayer=='Coach' and BrickColor.new'Brick yellow'
  306. fakerl.Name = 'FakeRight Leg'
  307. rl.Transparency = 1
  308. local fakell = ll:Clone()
  309. fakell.Parent = char
  310. fakell.TopSurface = 'SmoothNoOutlines'
  311. fakell.BottomSurface = 'SmoothNoOutlines'
  312. fakell.RightSurface = 'SmoothNoOutlines'
  313. fakell.LeftSurface = 'SmoothNoOutlines'
  314. fakell.FrontSurface = 'SmoothNoOutlines'
  315. fakell.BackSurface = 'SmoothNoOutlines'
  316. fakell.BrickColor = currentPlayer=='Rochelle' and BrickColor.new'Black' or currentPlayer == 'Nick' and BrickColor.new'Institutional white' or currentPlayer=='Ellis' and BrickColor.new'Really black' or currentPlayer=='Coach' and BrickColor.new'Brick yellow'
  317. fakell.Name = 'FakeRight Leg'
  318. ll.Transparency = 1
  319.  
  320. pcall(function()
  321. head.face:remove()
  322. end)
  323.  
  324. local lol = Instance.new("BillboardGui",fakehead)
  325. lol.StudsOffset = Vector3.new(0,2,0)
  326. lol.Size = UDim2.new(8,0,7,0)
  327. local lol2 = Instance.new("TextLabel",lol)
  328. lol2.Size = UDim2.new(1,0,1,0)
  329. lol2.Text = currentPlayer
  330. lol2.TextColor = currentPlayer=='Nick' and BrickColor.new("Really blue") or currentPlayer=='Ellis' and BrickColor.new('Light blue') or currentPlayer=='Rochelle' and BrickColor.new('Hot pink') or currentPlayer=='Coach' and BrickColor.new("Brown")
  331. lol2.BackgroundTransparency = 1
  332. lol2.TextScaled = false
  333. lol2.Font = 'Legacy'
  334. lol2.FontSize = 'Size24'
  335.  
  336. local fakeweld = Instance.new("Weld", fakehead)
  337. fakeweld.Part0 = head
  338. fakeweld.Part1 = fakehead
  339. local fakeweld2 = Instance.new("Weld", faketorso)
  340. fakeweld2.Part0 = torso
  341. fakeweld2.Part1 = faketorso
  342. local fakeweld3 = Instance.new("Weld", fakera)
  343. fakeweld3.Part0 = ra
  344. fakeweld3.Part1 = fakera
  345. local fakeweld4 = Instance.new("Weld", fakela)
  346. fakeweld4.Part0 = la
  347. fakeweld4.Part1 = fakela
  348. local fakeweld5 = Instance.new("Weld", fakerl)
  349. fakeweld5.Part0 = rl
  350. fakeweld5.Part1 = fakerl
  351. local fakeweld6 = Instance.new("Weld", fakell)
  352. fakeweld6.Part0 = ll
  353. fakeweld6.Part1 = fakell
  354.  
  355. if currentPlayer == 'Ellis' then
  356. local a = Instance.new("Hat",char)
  357. a.Name = 'Cap'
  358. a.AttachmentUp = Vector3.new(0, 1, 0)
  359. a.AttachmentRight = Vector3.new(1, 0, 0)
  360. a.AttachmentPos = Vector3.new(0, 0, 0)
  361. a.AttachmentForward = Vector3.new(0, 0, -1)
  362. local b = Instance.new("Part",a)
  363. b.Name = 'Handle'
  364. local c = Instance.new("SpecialMesh",b)
  365. c.TextureId = 'http://www.roblox.com/asset/?id=17424198'
  366. c.Name = 'Hat mesh'
  367. c.Scale = Vector3.new(1.05, 1.05, 1.05)
  368. c.MeshType = 'FileMesh'
  369. c.MeshId = 'http://www.roblox.com/asset/?id=16190466'
  370. elseif currentPlayer == 'Nick' then
  371. local a = Instance.new("Hat",char)
  372. a.Name = 'Tie'
  373. a.AttachmentPos = Vector3.new(0, 1.9, 0.55)
  374. local b = Instance.new("Part",a)
  375. b.Name = 'Handle'
  376. b.BrickColor = BrickColor.new'Really blue'
  377. local c = Instance.new("SpecialMesh",b)
  378. c.Scale = Vector3.new(1.4, 1.2, 1.4)
  379. c.MeshType = 'FileMesh'
  380. c.MeshId = 'http://www.roblox.com/asset/?id=28463033'
  381. c.TextureId = ''
  382. local a2 = Instance.new("Hat",char)
  383. a2.Name = 'Hair'
  384. a2.AttachmentPos = Vector3.new(0,0,0)
  385. local b2 = Instance.new("Part",a2)
  386. b2.Name = 'Handle'
  387. b2.BrickColor = BrickColor.new'Really black'
  388. local c2 = Instance.new("SpecialMesh",b2)
  389. c2.MeshType = 'FileMesh'
  390. c2.MeshId = 'http://www.roblox.com/asset/?id=1095708'
  391. c2.Scale = Vector3.new(1, 1, 1.9)
  392. elseif currentPlayer == 'Rochelle' then
  393. local a = Instance.new("Hat",char)
  394. a.AttachmentPos = Vector3.new(0,0.3,0.1)
  395. a.Name = 'Hair'
  396. local b = Instance.new("Part",a)
  397. b.Name = 'Handle'
  398. b.BrickColor = BrickColor.new'Really black'
  399. local c = Instance.new("SpecialMesh",b)
  400. c.MeshType = 'FileMesh'
  401. c.MeshId = 'http://www.roblox.com/asset/?id=13070796'
  402. c.Scale = Vector3.new(1, 0.5, 1)
  403. end
  404.  
  405. function clerp(c1,c2,al)
  406. local com1 = {c1.X,c1.Y,c1.Z,c1:toEulerAnglesXYZ()}
  407. local com2 = {c2.X,c2.Y,c2.Z,c2:toEulerAnglesXYZ()}
  408. for i,v in pairs(com1) do
  409. com1[i] = v+(com2[i]-v)*al
  410. end
  411. return CFrame.new(com1[1],com1[2],com1[3]) * CFrame.Angles(select(4,unpack(com1)))
  412. end
  413. humanoid.Jumping:connect(function()
  414. action = 'jumping'
  415. Controllers.Parent = nil
  416. end)
  417. humanoid.Died:connect(function()
  418. repeat Controllers.Parent = ControllerService wait() until nil
  419. pcall(function()
  420. plr:FindFirstChild(currentPlayer):remove()
  421. end)
  422. end)
  423. mouse.KeyDown:connect(function(key)
  424. if key:byte() == 48 then
  425. action = 'running'
  426. end
  427. if key == '2' or key == 'c' then
  428. action = action == 'crouch' and 'none' or 'crouch'
  429. end
  430. if key == 'r' then
  431. pcall(function()
  432. if ToolSelected:FindFirstChild'Ammo'.Value ~= MaxAmmuntition[ToolSelected.Name] then
  433. action = 'reloading'
  434. end
  435. end)
  436. end
  437. end)
  438. mouse.KeyUp:connect(function(key)
  439. if key:byte() == 48 then
  440. if action == 'running' then
  441. action = 'none'
  442. end
  443. end
  444. end)
  445. plr.Chatted:connect(function(chat)
  446. local emote = false
  447. if chat:sub(1,3) == '/e ' then
  448. emote = true
  449. chat = chat:sub(4)
  450. elseif chat:sub(1,7) == '/emote ' then
  451. emote = true
  452. chat = chat:sub(8)
  453. end
  454. if emote == true then
  455. if chat == 'dance' then
  456. action = 'dance'
  457. elseif chat == 'sit' then
  458. action = 'sit'
  459. elseif chat == 'lay' then
  460. if action ~= 'lay' then
  461. will_lay = true
  462. action = 'sit'
  463. end
  464. elseif chat == 'wave' then
  465. action = 'wave'
  466. elseif chat == 'squat' then
  467. action = 'squat'
  468. elseif chat == 'point' then
  469. action = 'point'
  470. end
  471. end
  472. end)
  473. while wait() do
  474. humanoid.WalkSpeed = (action == 'running' or lastaction == 'running') and 30 or (action == 'crouch' or lastaction == 'crouch') and 5 or 10
  475. torso.Anchored = false
  476. local rscf = rsc0
  477. local lscf = lsc0
  478. local rlcf = rlc0
  479. local llcf = llc0
  480. local rjcf = rootc0
  481. local ncf = neckc0
  482. local speed = 0.2
  483. local rayHit = false
  484. angle = (angle % 100) + anglespeed/10
  485. mvmnt = math.pi * math.sin(math.pi*2/100*(angle*10))
  486. local rayz = Ray.new(rootpart.Position, Vector3.new(0, -3.95, 0))
  487. local hitz, enz = workspace:findPartOnRay(rayz, char)
  488. local rayz1 = Ray.new(rootpart.Position, Vector3.new(-.5, -3.95, 0))
  489. local hitz1, enz1 = workspace:findPartOnRay(rayz1, char)
  490. local rayz2 = Ray.new(rootpart.Position, Vector3.new(.5, -3.95, 0))
  491. local hitz2, enz2 = workspace:findPartOnRay(rayz2, char)
  492. local rayz3 = Ray.new(rootpart.Position, Vector3.new(0, -3.95, -.5))
  493. local hitz3, enz3 = workspace:findPartOnRay(rayz3, char)
  494. local rayz4 = Ray.new(rootpart.Position, Vector3.new(0, -3.95, .5))
  495. local hitz4, enz4 = workspace:findPartOnRay(rayz4, char)
  496. local rotvellimit = action~='running' and 2 or 10
  497. local rotvel = torso.RotVelocity.y
  498. if rotvel > rotvellimit then
  499. rotvel = rotvellimit
  500. elseif rotvel < -rotvellimit then
  501. rotvel = -rotvellimit
  502. end
  503. if hitz or hitz1 or hitz2 or hitz3 or hitz4 then
  504. Controllers.Parent = ControllerService
  505. end
  506. if action == 'reloading' then
  507. if ToolSelected == nil then
  508. action = lastaction == 'crouch' and 'crouch' or lastaction == 'running' and 'running' or 'none'
  509. end
  510. if action == 'reloading' then
  511. humanoid.WalkSpeed = 0
  512. Controllers.Parent = nil
  513. speed = 0.2
  514. for waiting = 0,20 do
  515. if lastaction ~= 'crouch' then
  516. rjcf = rootc0
  517. lscf = lsc0 * CFrame.new(0.4,0,0) * CFrame.Angles(math.rad(90),0,math.rad(45))
  518. rscf = rsc0 * CFrame.new(-0.4,0,0) * CFrame.Angles(math.rad(95),0,math.rad(-45))
  519. ncf = neckc0 * CFrame.Angles(math.rad(-15),0,0)
  520. rlcf = rlc0 * CFrame.Angles(0,0,math.rad(5))
  521. llcf = llc0 * CFrame.Angles(0,0,math.rad(-5))
  522. rm.C0 = clerp(rm.C0,rscf,speed)
  523. lm.C0 = clerp(lm.C0,lscf,speed)
  524. rj.C0 = clerp(rj.C0,rjcf,speed)
  525. neck.C0 = clerp(neck.C0,ncf,speed)
  526. rlegm.C0 = clerp(rlegm.C0,rlcf,speed)
  527. llegm.C0 = clerp(llegm.C0,llcf,speed)
  528. else
  529. ncf = neckc0 * CFrame.Angles(math.rad(-15),0,0)
  530. rscf = rsc0 * CFrame.new(-0.4,0,0) * CFrame.Angles(math.rad(95),0,math.rad(-45))
  531. lscf = lsc0 * CFrame.new(0.4,0,0) * CFrame.Angles(math.rad(90),0,math.rad(45))
  532. rjcf = rootc0 * CFrame.new(0, -1.25, 0)
  533. llcf = llc0 * CFrame.new(0, 0, -.4999) * CFrame.Angles(-math.pi/2.2, 0, 0)
  534. rlcf = rlcf * CFrame.new(0, 1.25, -.85)
  535. rm.C0 = clerp(rm.C0,rscf,speed)
  536. lm.C0 = clerp(lm.C0,lscf,speed)
  537. rj.C0 = clerp(rj.C0,rjcf,speed)
  538. neck.C0 = clerp(neck.C0,ncf,speed)
  539. rlegm.C0 = clerp(rlegm.C0,rlcf,speed)
  540. llegm.C0 = clerp(llegm.C0,llcf,speed)
  541. end
  542. wait()
  543. end
  544. pcall(function()
  545. ToolSelected:FindFirstChild'Ammo'.Value = MaxAmmuntition[ToolSelected.Name]
  546. end)
  547. pcall(function()
  548. AmmoTextLabel.Text = 'Ammo amount: '..ToolSelected:FindFirstChild'Ammo'.Value or 'Ammo amount: No weapon'
  549. end)
  550. Controllers.Parent = ControllerService
  551. humanoid.WalkSpeed = 16
  552. action = lastaction == 'crouch' and 'crouch' or 'none'
  553. end
  554. end
  555. if humanoid.Sit then
  556. if action == 'dance' then action = lastaction end
  557. rjcf = rootc0
  558. rscf = rsc0 * CFrame.Angles(math.rad(90),0,0)
  559. lscf = lsc0 * CFrame.Angles(math.rad(90),0,0)
  560. rlcf = rlc0 * CFrame.Angles(math.rad(90),0,math.rad(15))
  561. llcf = llc0 * CFrame.Angles(math.rad(90),0,math.rad(-15))
  562. ncf = neckc0
  563. elseif action == 'sit' then
  564. if Vector3.new(torso.Velocity.x,0,torso.Velocity.z).magnitude > 2 then action = 'none' end
  565. if will_lay ~= true then
  566. rjcf = rootc0 * CFrame.new(0,-1.5,0) * CFrame.Angles(math.rad(25),0,0)
  567. rscf = rsc0 * CFrame.Angles(math.rad(-25),0,0)
  568. lscf = lsc0 * CFrame.Angles(math.rad(-25),0,0)
  569. rlcf = rlc0 * CFrame.Angles(math.rad(65),0,math.rad(15))
  570. llcf = llc0 * CFrame.Angles(math.rad(65),0,math.rad(-15))
  571. else
  572. rjcf = rootc0 * CFrame.new(0,-1.5,0) * CFrame.Angles(math.rad(25),0,0)
  573. rscf = rsc0 * CFrame.Angles(math.rad(-25),0,0)
  574. lscf = lsc0 * CFrame.Angles(math.rad(-25),0,0)
  575. rlcf = rlc0 * CFrame.Angles(math.rad(65),0,math.rad(15))
  576. llcf = llc0 * CFrame.Angles(math.rad(65),0,math.rad(-15))
  577. rm.C0 = clerp(rm.C0,rscf,speed)
  578. lm.C0 = clerp(lm.C0,lscf,speed)
  579. rj.C0 = clerp(rj.C0,rjcf,speed)
  580. neck.C0 = clerp(neck.C0,ncf,speed)
  581. rlegm.C0 = clerp(rlegm.C0,rlcf,speed)
  582. llegm.C0 = clerp(llegm.C0,llcf,speed)
  583. wait()
  584. will_lay = false
  585. action = 'lay'
  586. end
  587. elseif action == 'lay' then
  588. if Vector3.new(torso.Velocity.x,0,torso.Velocity.z).magnitude > 2 then action = 'none' end
  589. rjcf = rootc0 * CFrame.new(0,-1.5,0) * CFrame.Angles(math.rad(90),0,0)
  590. rscf = rsc0 * CFrame.Angles(0,0,math.rad(105))
  591. lscf = lsc0 * CFrame.Angles(0,0,math.rad(-105))
  592. rlcf = rlc0 * CFrame.Angles(0,0,math.rad(15))
  593. llcf = llc0 * CFrame.Angles(0,0,math.rad(-15))
  594. elseif action == 'wave' then
  595. if Vector3.new(torso.Velocity.x,0,torso.Velocity.z).magnitude > 2 then action = 'none' end
  596. anglespeed = 1
  597. speed = 0.25
  598. rjcf = rootc0 * CFrame.Angles(0,math.rad(45),0)
  599. ncf = neckc0 * CFrame.Angles(0,math.rad(-45),0)
  600. lscf = lsc0 * CFrame.Angles(0,0,math.rad(-15))
  601. rlcf = rlc0 * CFrame.Angles(0,0,math.rad(5))
  602. llcf = llc0 * CFrame.Angles(0,0,math.rad(-5))
  603. rscf = rsc0 * CFrame.Angles(0, -math.sin(angle)*0.008, math.pi/1.4+math.sin(angle)*.5)
  604. elseif action == 'squat' then
  605. if Vector3.new(torso.Velocity.x,0,torso.Velocity.z).magnitude > 2 then action = 'none' end
  606. anglespeed = 0.15
  607. speed = 0.25
  608. ncf = neckc0 * CFrame.Angles(math.pi/12-math.sin(angle)*0.005,0,0)
  609. rscf = rsc0 * CFrame.new(-.35, 0, -.35+math.sin(angle)*0.005) * CFrame.Angles(math.pi/2.2+math.sin(-angle)*.005, 0, -math.pi/4.5)
  610. lscf = lsc0 * CFrame.new(.35, 0, -.35+math.sin(angle)*0.005) * CFrame.Angles(math.pi/2.2+math.sin(angle)*.005, 0, math.pi/4.5)
  611. rjcf = rootc0 * CFrame.new(0, -0.9, 0.55) * CFrame.Angles(-math.pi/12+math.sin(angle)*0.005, 0, 0)
  612. llcf = llc0 * CFrame.new(0, .95, -.55) * CFrame.Angles(math.pi/12, 0, -math.rad(2))
  613. rlcf = rlcf * CFrame.new(0, .95, -.55) * CFrame.Angles(math.pi/14, 0, math.rad(2))
  614. elseif action == 'point' then
  615. if Vector3.new(torso.Velocity.x,0,torso.Velocity.z).magnitude > 2 then action = 'none' end
  616. anglespeed = 0.5
  617. speed = 0.25
  618. rjcf = rootc0 * CFrame.Angles(0,math.rad(45),0)
  619. ncf = neckc0 * CFrame.Angles(0,math.rad(-45),0)
  620. rscf = rsc0 * CFrame.Angles(math.rad(90),0,math.rad(45))
  621. lscf = lsc0 * CFrame.Angles(0,0,math.rad(-15))
  622. rlcf = rlc0 * CFrame.Angles(0,0,math.rad(5))
  623. llcf = llc0 * CFrame.Angles(0,0,math.rad(-5))
  624. elseif action == 'dance' then
  625. if Vector3.new(torso.Velocity.x,0,torso.Velocity.z).magnitude > 2 then action = 'none' end
  626. dancingtime = dancingtime + 1/60
  627. anglespeed = 1
  628. speed = 0.25
  629. if dancingtime <= 12 then
  630. ncf = neckc0 * CFrame.Angles(math.pi/24.85, 0, 0)
  631. rjcf = rootc0 * CFrame.new(0, 0.75 + -math.abs(math.sin(angle)), 0) * CFrame.Angles(0, 0, math.sin(angle)*.1)
  632. rscf = rsc0 * CFrame.Angles(math.pi-math.abs(math.sin(angle))*.5, 0, math.rad(2))
  633. lscf = lsc0 * CFrame.Angles(math.pi-math.abs(math.sin(angle))*.5, 0, -math.rad(2))
  634. rlcf = rlc0 * CFrame.Angles(math.sin(angle)*.25, 0, math.rad(5))
  635. llcf = llc0 * CFrame.Angles(-math.sin(angle)*.25, 0, -math.rad(5))
  636. elseif dancingtime <= 22 then
  637. ncf = neckc0 * CFrame.Angles(math.pi/24.85, 0, 0)
  638. rjcf = rootc0 * CFrame.new(0, math.abs(math.cos(angle)*.05), 0) * CFrame.Angles(0, math.sin(angle)*.035, math.sin(angle)*.015)
  639. rscf = rsc0 * CFrame.Angles(math.pi/2-math.abs(math.sin(angle))*.5, 0, math.rad(2))
  640. lscf = lsc0 * CFrame.Angles(math.pi/2-math.abs(math.sin(angle))*.5, 0, -math.rad(2))
  641. rlcf = rlc0 * CFrame.Angles(math.sin(angle)*.05, 0, math.rad(5))
  642. llcf = llc0 * CFrame.Angles(-math.sin(angle)*.05, 0, -math.rad(5))
  643. elseif dancingtime >= 22 then
  644. dancingtime = 0
  645. end
  646. elseif action == 'jumping' then
  647. anglespeed = 1
  648. speed = 0.175
  649. rayHit = false
  650. for waiting = 0, 8 do
  651. rjcf = rootc0 * CFrame.Angles(lastaction=='running' and math.rad(-15) or 0, 0, 0)
  652. rscf = rsc0 * CFrame.Angles(0, 0, math.rad(15))
  653. lscf = lsc0 * CFrame.Angles(0, 0, math.rad(-15))
  654. rlcf = rlc0 * CFrame.new(0, 0.5, -0.5) * CFrame.Angles(math.rad(-15), 0, 0)
  655. llcf = llc0 * CFrame.Angles(0, 0, 0)
  656. ncf = neckc0 * CFrame.Angles(lastaction=='running' and math.rad(15) or 0,0,0)
  657. rm.C0 = clerp(rm.C0,rscf,speed)
  658. lm.C0 = clerp(lm.C0,lscf,speed)
  659. rj.C0 = clerp(rj.C0,rjcf,speed)
  660. neck.C0 = clerp(neck.C0,ncf,speed)
  661. rlegm.C0 = clerp(rlegm.C0,rlcf,speed)
  662. llegm.C0 = clerp(llegm.C0,llcf,speed)
  663. wait()
  664. end
  665. action = (lastaction ~= 'dance' and lastaction ~= 'sit' and lastaction ~= 'lay') and lastaction or 'none'
  666. elseif not hitz and not hitz1 and not hitz2 and not hitz4 then
  667. if action == 'dance' then action = 'none' end
  668. anglespeed = 1
  669. speed = 0.175
  670. rjcf = rootc0 * CFrame.Angles(math.rad(-15),0,0)
  671. rscf = rsc0 * CFrame.Angles(0, 0, math.rad(15))
  672. lscf = lsc0 * CFrame.Angles(0, 0, math.rad(-15))
  673. rlcf = rlc0 * CFrame.new(0, 0.5, -0.5) * CFrame.Angles(math.rad(-15), 0, 0)
  674. llcf = llc0 * CFrame.Angles(0, 0, 0)
  675. ncf = neckc0 * CFrame.Angles(math.rad(15),0,0)
  676. elseif Vector3.new(torso.Velocity.x,0,torso.Velocity.z).magnitude < 2 then
  677. anglespeed = 0.3
  678. speed = 0.15
  679. if action ~= 'crouch' then
  680. idletime = idletime + 1/30
  681. if idletime < 12 then
  682. ncf = neckc0 * CFrame.Angles(-math.sin(angle)*0.07, 0, 0)
  683. rjcf = rootc0 * CFrame.Angles(0, 0, 0)
  684. if ToolSelected == nil then
  685. rscf = rsc0 * CFrame.Angles(math.sin(angle)*0.08, 0, 0)
  686. else
  687. rscf = rsc0 * CFrame.Angles(math.rad(90),0,0)
  688. end
  689. lscf = lsc0 * CFrame.Angles(math.sin(angle)*0.08, 0, 0)
  690. rlcf = rlc0 * CFrame.Angles(0, 0, math.rad(2.5))
  691. llcf = llc0 * CFrame.Angles(0, 0, -math.rad(2.5))
  692. elseif idletime < 22 then
  693. ncf = neckc0 * CFrame.Angles(-math.sin(angle)*0.07, 0, 0)
  694. rjcf = rootc0 * CFrame.Angles(0, 0, 0)
  695. if ToolSelected == nil then
  696. rscf = rsc0 * CFrame.Angles(math.sin(angle)*0.08, 0, 0)
  697. else
  698. rscf = rsc0 * CFrame.Angles(math.rad(90),0,0)
  699. end
  700. lscf = lsc0 * CFrame.Angles(math.sin(angle)*0.08, 0, 0)
  701. rlcf = rlc0 * CFrame.Angles(0, 0, math.rad(2.5))
  702. llcf = llc0 * CFrame.Angles(0, 0, -math.rad(2.5))
  703. else
  704. idletime = 0
  705. end
  706. else
  707. ncf = neckc0 * CFrame.Angles(-math.sin(angle)*0.07, 0, 0)
  708. if ToolSelected == nil then
  709. rscf = rsc0 * CFrame.Angles(0, -math.sin(angle)*0.08, math.pi/18)
  710. else
  711. rscf = rsc0 * CFrame.Angles(math.rad(90),0,0)
  712. end
  713. lscf = lsc0 * CFrame.Angles(0, math.sin(angle)*0.08, -math.pi/18)
  714. rjcf = rootc0 * CFrame.new(0, -1.25, 0)
  715. llcf = llc0 * CFrame.new(0, 0, -.4999) * CFrame.Angles(-math.pi/2.2, 0, 0)
  716. rlcf = rlcf * CFrame.new(0, 1.25, -.85)
  717. end
  718. elseif Vector3.new(torso.Velocity.x,0,torso.Velocity.z).magnitude <= 20 then
  719. if action == 'dance' then action = 'none' end
  720. anglespeed = 1.5
  721. speed = 0.25
  722. if action ~= 'crouch' then
  723. rjcf = rootc0 * CFrame.Angles(0,0,math.rad(rotvel)*2.5)
  724. if ToolSelected == nil then
  725. rscf = rsc0 * CFrame.Angles(math.sin(angle),0,0)
  726. else
  727. rscf = rsc0 * CFrame.Angles(math.rad(90),0,0)
  728. end
  729. lscf = lsc0 * CFrame.Angles(math.sin(-angle),0,0)
  730. rlcf = rlc0 * CFrame.Angles(math.sin(-angle),0,0)
  731. llcf = llc0 * CFrame.Angles(math.sin(angle),0,0)
  732. ncf = neckc0
  733. else
  734. speed = 0.25
  735. ncf = neckc0 * CFrame.Angles(math.pi/12,0,0)
  736. if ToolSelected == nil then
  737. rscf = rsc0 * CFrame.new(0, 0, math.sin(angle)*0.025) * CFrame.Angles(math.rad(45), 0, math.pi/18)
  738. else
  739. rscf = rsc0 * CFrame.Angles(math.rad(90),0,0)
  740. end
  741. lscf = lsc0 * CFrame.new(0, 0, math.sin(angle)*0.025) * CFrame.Angles(math.rad(-45), 0, -math.pi/18)
  742. rjcf = rootc0 * CFrame.new(0, -.7, 0) * CFrame.Angles(math.abs(math.sin(angle))*0.025 + -math.pi/12, 0, 0)
  743. llcf = llc0 * CFrame.new(0, .85 + .2 - math.cos(angle)*.2, -.5 + (-.4+math.sin(angle)*0.25)) * CFrame.Angles(math.pi/18 + -math.pi/10 - math.sin(angle)*.45, 0, 0)
  744. rlcf = rlcf * CFrame.new(0, .85 + .2 + math.cos(angle)*.2, -.5 + (-.25-math.sin(angle)*0.25)) * CFrame.Angles(math.pi/18 + -math.pi/10 + math.sin(angle)*.45, 0, 0)
  745. end
  746. elseif Vector3.new(torso.Velocity.x,0,torso.Velocity.z).magnitude > 20 then
  747. if action == 'dance' then action = 'none' end
  748. anglespeed = 2
  749. speed = .3
  750. rjcf = rootc0 * CFrame.Angles(math.rad(-15),0,math.rad(rotvel)*2.5)
  751. if ToolSelected == nil then
  752. rscf = rsc0 * CFrame.Angles(math.sin(angle),0,0)
  753. else
  754. rscf = rsc0 * CFrame.Angles(math.rad(90),0,0)
  755. end
  756. lscf = lsc0 * CFrame.Angles(math.sin(-angle),0,0)
  757. rlcf = rlc0 * CFrame.Angles(math.sin(-angle),0,0)
  758. llcf = llc0 * CFrame.Angles(math.sin(angle),0,0)
  759. ncf = neckc0 * CFrame.Angles(math.rad(15),0,0)
  760. end
  761. rlegm.C0 = clerp(rlegm.C0,rlcf,speed)
  762. llegm.C0 = clerp(llegm.C0,llcf,speed)
  763. neck.C0 = clerp(neck.C0,ncf,speed)
  764. lm.C0 = clerp(lm.C0,lscf,speed)
  765. rm.C0 = clerp(rm.C0,rscf,speed)
  766. rj.C0 = clerp(rj.C0,rjcf,speed)
  767. lastaction = action
  768. end
  769.  
  770. --[[
  771. ]]
Add Comment
Please, Sign In to add comment