Advertisement
shgsiughiiruhdu12354

TrollhaxxV2 (NEW UPDATE!!! RELEASED)

Jan 17th, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.48 KB | None | 0 0
  1. -------------------------------------------------
  2. -- By ggrelior333_lolz#8481 --
  3. -------------------------------------------------
  4.  
  5. game.StarterGui:SetCore("SendNotification", {
  6. Title = "TrollhaxxV2 loaded";
  7. Text = "Go fucking kill them";
  8. Icon = "";
  9. Duration = "30";
  10. callbakc = bindableFunction;
  11. Button1 = "Ok";
  12. })
  13. wait(0.2)
  14.  
  15. -- Instances:
  16.  
  17. local TrollhaxxV2 = Instance.new("ScreenGui")
  18. local Main = Instance.new("Frame")
  19. local Frame = Instance.new("Frame")
  20. local TextLabel = Instance.new("TextLabel")
  21. local TextButton = Instance.new("TextButton")
  22. local TextButton_2 = Instance.new("TextButton")
  23. local TextButton_3 = Instance.new("TextButton")
  24. local TextButton_4 = Instance.new("TextButton")
  25. local Frame_2 = Instance.new("Frame")
  26. local ImageLabel = Instance.new("ImageLabel")
  27. local L = Instance.new("Frame")
  28. local Frame_3 = Instance.new("Frame")
  29. local TextLabel_2 = Instance.new("TextLabel")
  30. local TextButton_5 = Instance.new("TextButton")
  31. local Frame_4 = Instance.new("Frame")
  32. local TextButton_6 = Instance.new("TextButton")
  33. local TextButton_7 = Instance.new("TextButton")
  34. local TextButton_8 = Instance.new("TextButton")
  35. local Annoy = Instance.new("Frame")
  36. local Frame_5 = Instance.new("Frame")
  37. local TextLabel_3 = Instance.new("TextLabel")
  38. local TextButton_9 = Instance.new("TextButton")
  39. local Frame_6 = Instance.new("Frame")
  40. local TextButton_10 = Instance.new("TextButton")
  41. local TextButton_11 = Instance.new("TextButton")
  42.  
  43. --Properties:
  44.  
  45. TrollhaxxV2.Name = "TrollhaxxV2"
  46. TrollhaxxV2.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  47. TrollhaxxV2.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  48.  
  49. Main.Name = "Main"
  50. Main.Parent = TrollhaxxV2
  51. Main.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  52. Main.BorderSizePixel = 0
  53. Main.Position = UDim2.new(0.287564754, 0, 0.334152341, 0)
  54. Main.Size = UDim2.new(0, 492, 0, 269)
  55.  
  56. Frame.Parent = Main
  57. Frame.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  58. Frame.BorderSizePixel = 0
  59. Frame.Size = UDim2.new(0, 492, 0, 32)
  60.  
  61. TextLabel.Parent = Frame
  62. TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  63. TextLabel.BackgroundTransparency = 2.000
  64. TextLabel.Size = UDim2.new(0, 492, 0, 32)
  65. TextLabel.Font = Enum.Font.SourceSans
  66. TextLabel.Text = "Trollhaxx V2"
  67. TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  68. TextLabel.TextScaled = true
  69. TextLabel.TextSize = 14.000
  70. TextLabel.TextWrapped = true
  71.  
  72. TextButton.Parent = Main
  73. TextButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  74. TextButton.BorderSizePixel = 0
  75. TextButton.Position = UDim2.new(0.595528424, 0, 0.769516706, 0)
  76. TextButton.Size = UDim2.new(0, 174, 0, 49)
  77. TextButton.Font = Enum.Font.SourceSans
  78. TextButton.Text = "Local"
  79. TextButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  80. TextButton.TextScaled = true
  81. TextButton.TextSize = 14.000
  82. TextButton.TextWrapped = true
  83.  
  84. TextButton_2.Parent = Main
  85. TextButton_2.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  86. TextButton_2.BorderSizePixel = 0
  87. TextButton_2.Position = UDim2.new(0.0508129783, 0, 0.769516706, 0)
  88. TextButton_2.Size = UDim2.new(0, 174, 0, 49)
  89. TextButton_2.Font = Enum.Font.SourceSans
  90. TextButton_2.Text = "Annoy"
  91. TextButton_2.TextColor3 = Color3.fromRGB(255, 255, 255)
  92. TextButton_2.TextScaled = true
  93. TextButton_2.TextSize = 14.000
  94. TextButton_2.TextWrapped = true
  95.  
  96. TextButton_3.Parent = Main
  97. TextButton_3.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  98. TextButton_3.BorderSizePixel = 0
  99. TextButton_3.Position = UDim2.new(0.949186981, 0, 0, 0)
  100. TextButton_3.Size = UDim2.new(0, 25, 0, 24)
  101. TextButton_3.Font = Enum.Font.SourceSans
  102. TextButton_3.Text = "X"
  103. TextButton_3.TextColor3 = Color3.fromRGB(255, 255, 255)
  104. TextButton_3.TextScaled = true
  105. TextButton_3.TextSize = 14.000
  106. TextButton_3.TextWrapped = true
  107.  
  108. TextButton_4.Parent = Main
  109. TextButton_4.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  110. TextButton_4.BorderSizePixel = 0
  111. TextButton_4.Position = UDim2.new(0.898373961, 0, 0, 0)
  112. TextButton_4.Size = UDim2.new(0, 25, 0, 24)
  113. TextButton_4.Font = Enum.Font.SourceSans
  114. TextButton_4.Text = "_"
  115. TextButton_4.TextColor3 = Color3.fromRGB(255, 255, 255)
  116. TextButton_4.TextScaled = true
  117. TextButton_4.TextSize = 14.000
  118. TextButton_4.TextWrapped = true
  119.  
  120. Frame_2.Parent = Main
  121. Frame_2.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  122. Frame_2.BorderSizePixel = 0
  123. Frame_2.Position = UDim2.new(0, 0, 0.118959107, 0)
  124. Frame_2.Size = UDim2.new(0, 492, 0, 7)
  125.  
  126. ImageLabel.Parent = Main
  127. ImageLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  128. ImageLabel.BackgroundTransparency = 1.000
  129. ImageLabel.BorderSizePixel = 0
  130. ImageLabel.Position = UDim2.new(0.33739838, 0, 0.211895913, 0)
  131. ImageLabel.Size = UDim2.new(0, 159, 0, 150)
  132. ImageLabel.Image = "http://www.roblox.com/asset/?id=502496134"
  133. ImageLabel.ImageColor3 = Color3.fromRGB(50, 50, 50)
  134.  
  135. L.Name = "L"
  136. L.Parent = TrollhaxxV2
  137. L.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  138. L.BorderSizePixel = 0
  139. L.Position = UDim2.new(0.753022432, 0, 0.186732188, 0)
  140. L.Size = UDim2.new(0, 243, 0, 389)
  141. L.Visible = false
  142.  
  143. Frame_3.Parent = L
  144. Frame_3.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  145. Frame_3.BorderSizePixel = 0
  146. Frame_3.Size = UDim2.new(0, 243, 0, 32)
  147.  
  148. TextLabel_2.Parent = Frame_3
  149. TextLabel_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  150. TextLabel_2.BackgroundTransparency = 2.000
  151. TextLabel_2.Size = UDim2.new(0, 243, 0, 32)
  152. TextLabel_2.Font = Enum.Font.SourceSans
  153. TextLabel_2.Text = "Local"
  154. TextLabel_2.TextColor3 = Color3.fromRGB(255, 255, 255)
  155. TextLabel_2.TextScaled = true
  156. TextLabel_2.TextSize = 14.000
  157. TextLabel_2.TextWrapped = true
  158.  
  159. TextButton_5.Parent = L
  160. TextButton_5.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  161. TextButton_5.BorderSizePixel = 0
  162. TextButton_5.Position = UDim2.new(0.895689011, 0, 0, 0)
  163. TextButton_5.Size = UDim2.new(0, 25, 0, 24)
  164. TextButton_5.Font = Enum.Font.SourceSans
  165. TextButton_5.Text = "X"
  166. TextButton_5.TextColor3 = Color3.fromRGB(255, 255, 255)
  167. TextButton_5.TextScaled = true
  168. TextButton_5.TextSize = 14.000
  169. TextButton_5.TextWrapped = true
  170.  
  171. Frame_4.Parent = L
  172. Frame_4.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  173. Frame_4.BorderSizePixel = 0
  174. Frame_4.Position = UDim2.new(0, 0, 0.0803986788, 0)
  175. Frame_4.Size = UDim2.new(0, 243, 0, 7)
  176.  
  177. TextButton_6.Parent = L
  178. TextButton_6.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  179. TextButton_6.BorderSizePixel = 0
  180. TextButton_6.Position = UDim2.new(0, 0, 0.179948583, 0)
  181. TextButton_6.Size = UDim2.new(0, 242, 0, 41)
  182. TextButton_6.Font = Enum.Font.SourceSans
  183. TextButton_6.Text = "Fly"
  184. TextButton_6.TextColor3 = Color3.fromRGB(255, 255, 255)
  185. TextButton_6.TextScaled = true
  186. TextButton_6.TextSize = 14.000
  187. TextButton_6.TextWrapped = true
  188.  
  189. TextButton_7.Parent = L
  190. TextButton_7.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  191. TextButton_7.BorderSizePixel = 0
  192. TextButton_7.Position = UDim2.new(0, 0, 0.447300792, 0)
  193. TextButton_7.Size = UDim2.new(0, 242, 0, 41)
  194. TextButton_7.Font = Enum.Font.SourceSans
  195. TextButton_7.Text = "Speed&Jump"
  196. TextButton_7.TextColor3 = Color3.fromRGB(255, 255, 255)
  197. TextButton_7.TextScaled = true
  198. TextButton_7.TextSize = 14.000
  199. TextButton_7.TextWrapped = true
  200.  
  201. TextButton_8.Parent = L
  202. TextButton_8.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  203. TextButton_8.BorderSizePixel = 0
  204. TextButton_8.Position = UDim2.new(0, 0, 0.735218525, 0)
  205. TextButton_8.Size = UDim2.new(0, 242, 0, 41)
  206. TextButton_8.Font = Enum.Font.SourceSans
  207. TextButton_8.Text = "Funny animation (R6 only)"
  208. TextButton_8.TextColor3 = Color3.fromRGB(255, 255, 255)
  209. TextButton_8.TextScaled = true
  210. TextButton_8.TextSize = 14.000
  211. TextButton_8.TextWrapped = true
  212.  
  213. Annoy.Name = "Annoy"
  214. Annoy.Parent = TrollhaxxV2
  215. Annoy.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  216. Annoy.BorderSizePixel = 0
  217. Annoy.Position = UDim2.new(0.753022432, 0, 0.186732188, 0)
  218. Annoy.Size = UDim2.new(0, 243, 0, 261)
  219. Annoy.Visible = false
  220.  
  221. Frame_5.Parent = Annoy
  222. Frame_5.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  223. Frame_5.BorderSizePixel = 0
  224. Frame_5.Size = UDim2.new(0, 243, 0, 32)
  225.  
  226. TextLabel_3.Parent = Frame_5
  227. TextLabel_3.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  228. TextLabel_3.BackgroundTransparency = 2.000
  229. TextLabel_3.Size = UDim2.new(0, 243, 0, 32)
  230. TextLabel_3.Font = Enum.Font.SourceSans
  231. TextLabel_3.Text = "Annoy"
  232. TextLabel_3.TextColor3 = Color3.fromRGB(255, 255, 255)
  233. TextLabel_3.TextScaled = true
  234. TextLabel_3.TextSize = 14.000
  235. TextLabel_3.TextWrapped = true
  236.  
  237. TextButton_9.Parent = Annoy
  238. TextButton_9.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  239. TextButton_9.BorderSizePixel = 0
  240. TextButton_9.Position = UDim2.new(0.895689011, 0, 0, 0)
  241. TextButton_9.Size = UDim2.new(0, 25, 0, 24)
  242. TextButton_9.Font = Enum.Font.SourceSans
  243. TextButton_9.Text = "X"
  244. TextButton_9.TextColor3 = Color3.fromRGB(255, 255, 255)
  245. TextButton_9.TextScaled = true
  246. TextButton_9.TextSize = 14.000
  247. TextButton_9.TextWrapped = true
  248.  
  249. Frame_6.Parent = Annoy
  250. Frame_6.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  251. Frame_6.BorderSizePixel = 0
  252. Frame_6.Position = UDim2.new(-0.00411522621, 0, 0.122544274, 0)
  253. Frame_6.Size = UDim2.new(0, 243, 0, 7)
  254.  
  255. TextButton_10.Parent = Annoy
  256. TextButton_10.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  257. TextButton_10.BorderSizePixel = 0
  258. TextButton_10.Position = UDim2.new(-0.00411522621, 0, 0.302603215, 0)
  259. TextButton_10.Size = UDim2.new(0, 242, 0, 41)
  260. TextButton_10.Font = Enum.Font.SourceSans
  261. TextButton_10.Text = "Random sound"
  262. TextButton_10.TextColor3 = Color3.fromRGB(255, 255, 255)
  263. TextButton_10.TextScaled = true
  264. TextButton_10.TextSize = 14.000
  265. TextButton_10.TextWrapped = true
  266.  
  267. TextButton_11.Parent = Annoy
  268. TextButton_11.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  269. TextButton_11.BorderSizePixel = 0
  270. TextButton_11.Position = UDim2.new(-0.00411522621, 0, 0.734410882, 0)
  271. TextButton_11.Size = UDim2.new(0, 242, 0, 41)
  272. TextButton_11.Font = Enum.Font.SourceSans
  273. TextButton_11.Text = "Funny animation (R6 only)"
  274. TextButton_11.TextColor3 = Color3.fromRGB(255, 255, 255)
  275. TextButton_11.TextScaled = true
  276. TextButton_11.TextSize = 14.000
  277. TextButton_11.TextWrapped = true
  278.  
  279. -- Scripts:
  280.  
  281. local function OHAHJUB_fake_script() -- TextButton.LocalScript
  282. local script = Instance.new('LocalScript', TextButton)
  283.  
  284. script.Parent.MouseButton1Click:Connect(function()
  285. script.Parent.Parent.Parent.L.Visible = true
  286. end)
  287. end
  288. coroutine.wrap(OHAHJUB_fake_script)()
  289. local function LKNK_fake_script() -- TextButton_2.LocalScript
  290. local script = Instance.new('LocalScript', TextButton_2)
  291.  
  292. script.Parent.MouseButton1Click:Connect(function()
  293. script.Parent.Parent.Parent.Annoy.Visible = true
  294. end)
  295. end
  296. coroutine.wrap(LKNK_fake_script)()
  297. local function QTQYBF_fake_script() -- Main.Draggable
  298. local script = Instance.new('LocalScript', Main)
  299.  
  300. local frame = script.Parent.Parent.Main
  301.  
  302. frame.Draggable = true
  303. frame.Active = true
  304. end
  305. coroutine.wrap(QTQYBF_fake_script)()
  306. local function VTQW_fake_script() -- TextButton_5.LocalScript
  307. local script = Instance.new('LocalScript', TextButton_5)
  308.  
  309. script.Parent.MouseButton1Click:Connect(function()
  310. script.Parent.Parent.Visible = false
  311. end)
  312. end
  313. coroutine.wrap(VTQW_fake_script)()
  314. local function WVMKC_fake_script() -- L.Draggable
  315. local script = Instance.new('LocalScript', L)
  316.  
  317. local frame = script.Parent.Parent.L
  318.  
  319. frame.Draggable = true
  320. frame.Active = true
  321. end
  322. coroutine.wrap(WVMKC_fake_script)()
  323. local function BXLIFX_fake_script() -- TextButton_6.Fly
  324. local script = Instance.new('LocalScript', TextButton_6)
  325.  
  326. -- Created By FormerPocketLegender. Place in starterpack! This is a local script, so it won't work anywhere else :D
  327.  
  328. -- Go to line 57 to modify the hotkey to stop flying and to start flying again. I already set "e" to default, you can change it if you want.
  329.  
  330. -- Credit by a screen text gui or in game description is appreciated, or else I'll become sad ;(
  331. script.Parent.MouseButton1Click:Connect(function()
  332. repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Torso") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")
  333. local mouse = game.Players.LocalPlayer:GetMouse()
  334. repeat wait() until mouse
  335. local plr = game.Players.LocalPlayer
  336. local torso = plr.Character.Torso
  337. local flying = true
  338. local deb = true
  339. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  340. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  341. local maxspeed = 50
  342. local speed = 0
  343. function Fly()
  344. local bg = Instance.new("BodyGyro", torso)
  345. bg.P = 9e4
  346. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  347. bg.cframe = torso.CFrame
  348. local bv = Instance.new("BodyVelocity", torso)
  349. bv.velocity = Vector3.new(0,0.1,0)
  350. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  351. repeat wait()
  352. plr.Character.Humanoid.PlatformStand = true
  353. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  354. speed = speed+.5+(speed/maxspeed)
  355. if speed > maxspeed then
  356. speed = maxspeed
  357. end
  358. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  359. speed = speed-1
  360. if speed < 0 then
  361. speed = 0
  362. end
  363. end
  364. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  365. bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (ctrl.f+ctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(ctrl.l+ctrl.r,(ctrl.f+ctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speed
  366. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  367. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  368. bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (lastctrl.f+lastctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(lastctrl.l+lastctrl.r,(lastctrl.f+lastctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speed
  369. else
  370. bv.velocity = Vector3.new(0,0.1,0)
  371. end
  372. bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  373. until not flying
  374. ctrl = {f = 0, b = 0, l = 0, r = 0}
  375. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  376. speed = 0
  377. bg:Destroy()
  378. bv:Destroy()
  379. plr.Character.Humanoid.PlatformStand = false
  380. end
  381. mouse.KeyDown:connect(function(key)
  382. if key:lower() == "f" then
  383. if flying then flying = false
  384. else
  385. flying = true
  386. Fly()
  387. end
  388. elseif key:lower() == "w" then
  389. ctrl.f = 1
  390. elseif key:lower() == "s" then
  391. ctrl.b = -1
  392. elseif key:lower() == "a" then
  393. ctrl.l = -1
  394. elseif key:lower() == "d" then
  395. ctrl.r = 1
  396. end
  397. end)
  398. mouse.KeyUp:connect(function(key)
  399. if key:lower() == "w" then
  400. ctrl.f = 0
  401. elseif key:lower() == "s" then
  402. ctrl.b = 0
  403. elseif key:lower() == "a" then
  404. ctrl.l = 0
  405. elseif key:lower() == "d" then
  406. ctrl.r = 0
  407. end
  408. end)
  409. Fly()
  410. end)
  411. end
  412. coroutine.wrap(BXLIFX_fake_script)()
  413. local function MNQAJPU_fake_script() -- TextButton_7.LocalScript
  414. local script = Instance.new('LocalScript', TextButton_7)
  415.  
  416. script.Parent.MouseButton1Click:Connect(function()
  417. script.Parent.Parent.Parent.Parent.Parent.Players.LocalPlayer.Character.WalkSpeed = 150
  418. script.Parent.Parent.Parent.Parent.Parent.Players.LocalPlayer.Character.JumpPower = 150
  419. end)
  420. end
  421. coroutine.wrap(MNQAJPU_fake_script)()
  422. local function HTAIWQ_fake_script() -- TextButton_8.Animation Handler (put in workspace)
  423. local script = Instance.new('Script', TextButton_8)
  424.  
  425.  
  426.  
  427. function onPlayerEntered(newPlayer)
  428. newPlayer.Changed:connect(function (property)
  429. if (property == "Character") then
  430. onPlayerRespawned(newPlayer)
  431. end
  432. end)
  433. end
  434.  
  435. game.Players.PlayerAdded:connect(onPlayerEntered)
  436. end
  437. coroutine.wrap(HTAIWQ_fake_script)()
  438. local function TPDDN_fake_script() -- nil.Anima
  439. local script = Instance.new('LocalScript', nil)
  440.  
  441. function waitForChild(parent, childName)
  442. local child = parent:findFirstChild(childName)
  443. if child then return child end
  444. while true do
  445. child = parent.ChildAdded:wait()
  446. if child.Name==childName then return child end
  447. end
  448. end
  449.  
  450. local Figure = script.Parent
  451. local Torso = waitForChild(Figure, "Torso")
  452. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  453. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  454. local RightHip = waitForChild(Torso, "Right Hip")
  455. local LeftHip = waitForChild(Torso, "Left Hip")
  456. local Neck = waitForChild(Torso, "Neck")
  457. local Humanoid = waitForChild(Figure, "Humanoid")
  458. local pose = "Standing"
  459.  
  460. local currentAnim = ""
  461. local currentAnimTrack = nil
  462. local currentAnimKeyframeHandler = nil
  463. local currentAnimSpeed = 1.0
  464. local oldAnimTrack = nil
  465. local animTable = {}
  466. local animNames = {
  467. idle = {
  468. { id = "rbxassetid://516957254", weight = 9 },
  469. { id = "rbxassetid://516957254", weight = 1 }
  470. },
  471. walk = {
  472. { id = "rbxassetid://125749145", weight = 10 }
  473. },
  474. run = {
  475. { id = "run.xml", weight = 10 }
  476. },
  477. jump = {
  478. { id = "rbxassetid://125750702", weight = 10 }
  479. },
  480. fall = {
  481. { id = "rbxassetid://125750759", weight = 10 }
  482. },
  483. climb = {
  484. { id = "rbxassetid://125750800", weight = 10 }
  485. },
  486. toolnone = {
  487. { id = "rbxassetid://125750867", weight = 10 }
  488. },
  489. toolslash = {
  490. { id = "rbxassetid://129967390", weight = 10 }
  491. -- { id = "slash.xml", weight = 10 }
  492. },
  493. toollunge = {
  494. { id = "rbxassetid://129967478", weight = 10 }
  495. },
  496. wave = {
  497. { id = "rbxassetid://128777973", weight = 10 }
  498. },
  499. point = {
  500. { id = "rbxassetid://128853357", weight = 10 }
  501. },
  502. dance = {
  503. { id = "rbxassetid://130018893", weight = 10 },
  504. { id = "rbxassetid://132546839", weight = 10 },
  505. { id = "rbxassetid://132546884", weight = 10 }
  506. },
  507. laugh = {
  508. { id = "rbxassetid://129423131", weight = 10 }
  509. },
  510. cheer = {
  511. { id = "rbxassetid://=129423030", weight = 10 }
  512. },
  513. }
  514.  
  515. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  516. local emoteNames = { wave = false, point = false, dance = true, laugh = false, cheer = false}
  517.  
  518. math.randomseed(tick())
  519.  
  520. -- Setup animation objects
  521. for name, fileList in pairs(animNames) do
  522. animTable[name] = {}
  523. animTable[name].count = 0
  524. animTable[name].totalWeight = 0
  525.  
  526. -- check for config values
  527. local config = script:FindFirstChild(name)
  528. if (config ~= nil) then
  529. -- print("Loading anims " .. name)
  530. local idx = 1
  531. for _, childPart in pairs(config:GetChildren()) do
  532. animTable[name][idx] = {}
  533. animTable[name][idx].anim = childPart
  534. local weightObject = childPart:FindFirstChild("Weight")
  535. if (weightObject == nil) then
  536. animTable[name][idx].weight = 1
  537. else
  538. animTable[name][idx].weight = weightObject.Value
  539. end
  540. animTable[name].count = animTable[name].count + 1
  541. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  542. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  543. idx = idx + 1
  544. end
  545. end
  546.  
  547. -- fallback to defaults
  548. if (animTable[name].count <= 0) then
  549. for idx, anim in pairs(fileList) do
  550. animTable[name][idx] = {}
  551. animTable[name][idx].anim = Instance.new("Animation")
  552. animTable[name][idx].anim.Name = name
  553. animTable[name][idx].anim.AnimationId = anim.id
  554. animTable[name][idx].weight = anim.weight
  555. animTable[name].count = animTable[name].count + 1
  556. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  557. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  558. end
  559. end
  560. end
  561.  
  562. -- ANIMATION
  563.  
  564. -- declarations
  565. local toolAnim = "None"
  566. local toolAnimTime = 0
  567.  
  568. local jumpAnimTime = 0
  569. local jumpAnimDuration = 0.175
  570.  
  571. local toolTransitionTime = 0.1
  572. local fallTransitionTime = 0.2
  573. local jumpMaxLimbVelocity = 0.75
  574.  
  575. -- functions
  576.  
  577. function stopAllAnimations()
  578. local oldAnim = currentAnim
  579.  
  580. -- return to idle if finishing an emote
  581. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  582. oldAnim = "idle"
  583. end
  584.  
  585. currentAnim = ""
  586. if (currentAnimKeyframeHandler ~= nil) then
  587. currentAnimKeyframeHandler:disconnect()
  588. end
  589.  
  590. if (oldAnimTrack ~= nil) then
  591. oldAnimTrack:Stop()
  592. oldAnimTrack:Destroy()
  593. oldAnimTrack = nil
  594. end
  595. if (currentAnimTrack ~= nil) then
  596. currentAnimTrack:Stop()
  597. currentAnimTrack:Destroy()
  598. currentAnimTrack = nil
  599. end
  600. return oldAnim
  601. end
  602.  
  603. function setAnimationSpeed(speed)
  604. if speed ~= currentAnimSpeed then
  605. currentAnimSpeed = speed
  606. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  607. end
  608. end
  609.  
  610. function keyFrameReachedFunc(frameName)
  611. if (frameName == "End") then
  612. -- print("Keyframe : ".. frameName)
  613. local repeatAnim = stopAllAnimations()
  614. local animSpeed = currentAnimSpeed
  615. playAnimation(repeatAnim, 0.0, Humanoid)
  616. setAnimationSpeed(animSpeed)
  617. end
  618. end
  619.  
  620. -- Preload animations
  621. function playAnimation(animName, transitionTime, humanoid)
  622. if (animName ~= currentAnim) then
  623.  
  624. if (oldAnimTrack ~= nil) then
  625. oldAnimTrack:Stop()
  626. oldAnimTrack:Destroy()
  627. end
  628.  
  629. currentAnimSpeed = 1.0
  630. local roll = math.random(1, animTable[animName].totalWeight)
  631. local origRoll = roll
  632. local idx = 1
  633. while (roll > animTable[animName][idx].weight) do
  634. roll = roll - animTable[animName][idx].weight
  635. idx = idx + 1
  636. end
  637. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  638. local anim = animTable[animName][idx].anim
  639.  
  640. -- load it to the humanoid; get AnimationTrack
  641. oldAnimTrack = currentAnimTrack
  642. currentAnimTrack = humanoid:LoadAnimation(anim)
  643.  
  644. -- play the animation
  645. currentAnimTrack:Play(transitionTime)
  646. currentAnim = animName
  647.  
  648. -- set up keyframe name triggers
  649. if (currentAnimKeyframeHandler ~= nil) then
  650. currentAnimKeyframeHandler:disconnect()
  651. end
  652. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  653. end
  654. end
  655.  
  656. -------------------------------------------------------------------------------------------
  657. -------------------------------------------------------------------------------------------
  658.  
  659. local toolAnimName = ""
  660. local toolOldAnimTrack = nil
  661. local toolAnimTrack = nil
  662. local currentToolAnimKeyframeHandler = nil
  663.  
  664. function toolKeyFrameReachedFunc(frameName)
  665. if (frameName == "End") then
  666. -- print("Keyframe : ".. frameName)
  667. local repeatAnim = stopToolAnimations()
  668. playToolAnimation(repeatAnim, 0.0, Humanoid)
  669. end
  670. end
  671.  
  672.  
  673. function playToolAnimation(animName, transitionTime, humanoid)
  674. if (animName ~= toolAnimName) then
  675.  
  676. if (toolAnimTrack ~= nil) then
  677. toolAnimTrack:Stop()
  678. toolAnimTrack:Destroy()
  679. transitionTime = 0
  680. end
  681.  
  682. local roll = math.random(1, animTable[animName].totalWeight)
  683. local origRoll = roll
  684. local idx = 1
  685. while (roll > animTable[animName][idx].weight) do
  686. roll = roll - animTable[animName][idx].weight
  687. idx = idx + 1
  688. end
  689. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  690. local anim = animTable[animName][idx].anim
  691.  
  692. -- load it to the humanoid; get AnimationTrack
  693. toolOldAnimTrack = toolAnimTrack
  694. toolAnimTrack = humanoid:LoadAnimation(anim)
  695.  
  696. -- play the animation
  697. toolAnimTrack:Play(transitionTime)
  698. toolAnimName = animName
  699.  
  700. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  701. end
  702. end
  703.  
  704. function stopToolAnimations()
  705. local oldAnim = toolAnimName
  706.  
  707. if (currentToolAnimKeyframeHandler ~= nil) then
  708. currentToolAnimKeyframeHandler:disconnect()
  709. end
  710.  
  711. toolAnimName = ""
  712. if (toolAnimTrack ~= nil) then
  713. toolAnimTrack:Stop()
  714. toolAnimTrack:Destroy()
  715. toolAnimTrack = nil
  716. end
  717.  
  718.  
  719. return oldAnim
  720. end
  721.  
  722. -------------------------------------------------------------------------------------------
  723. -------------------------------------------------------------------------------------------
  724.  
  725.  
  726. function onRunning(speed)
  727. if speed>0 then
  728. playAnimation("walk", 0.1, Humanoid)
  729. pose = "Running"
  730. else
  731. playAnimation("idle", 0.1, Humanoid)
  732. pose = "Standing"
  733. end
  734. end
  735.  
  736. function onDied()
  737. pose = "Dead"
  738. end
  739.  
  740. function onJumping()
  741. playAnimation("jump", 0.1, Humanoid)
  742. jumpAnimTime = jumpAnimDuration
  743. pose = "Jumping"
  744. end
  745.  
  746. function onClimbing(speed)
  747. playAnimation("climb", 0.1, Humanoid)
  748. setAnimationSpeed(speed / 12.0)
  749. pose = "Climbing"
  750. end
  751.  
  752. function onGettingUp()
  753. pose = "GettingUp"
  754. end
  755.  
  756. function onFreeFall()
  757. if (jumpAnimTime <= 0) then
  758. playAnimation("fall", fallTransitionTime, Humanoid)
  759. end
  760. pose = "FreeFall"
  761. end
  762.  
  763. function onFallingDown()
  764. pose = "FallingDown"
  765. end
  766.  
  767. function onSeated()
  768. pose = "Seated"
  769. end
  770.  
  771. function onPlatformStanding()
  772. pose = "PlatformStanding"
  773. end
  774.  
  775. function onSwimming(speed)
  776. if speed>0 then
  777. pose = "Running"
  778. else
  779. pose = "Standing"
  780. end
  781. end
  782.  
  783. function getTool()
  784. for _, kid in ipairs(Figure:GetChildren()) do
  785. if kid.className == "Tool" then return kid end
  786. end
  787. return nil
  788. end
  789.  
  790. function getToolAnim(tool)
  791. for _, c in ipairs(tool:GetChildren()) do
  792. if c.Name == "toolanim" and c.className == "StringValue" then
  793. return c
  794. end
  795. end
  796. return nil
  797. end
  798.  
  799. function animateTool()
  800.  
  801. if (toolAnim == "None") then
  802. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  803. return
  804. end
  805.  
  806. if (toolAnim == "Slash") then
  807. playToolAnimation("toolslash", 0, Humanoid)
  808. return
  809. end
  810.  
  811. if (toolAnim == "Lunge") then
  812. playToolAnimation("toollunge", 0, Humanoid)
  813. return
  814. end
  815. end
  816.  
  817. function moveSit()
  818. RightShoulder.MaxVelocity = 0.15
  819. LeftShoulder.MaxVelocity = 0.15
  820. RightShoulder:SetDesiredAngle(3.14 /2)
  821. LeftShoulder:SetDesiredAngle(-3.14 /2)
  822. RightHip:SetDesiredAngle(3.14 /2)
  823. LeftHip:SetDesiredAngle(-3.14 /2)
  824. end
  825.  
  826. local lastTick = 0
  827.  
  828. function move(time)
  829. local amplitude = 1
  830. local frequency = 1
  831. local deltaTime = time - lastTick
  832. lastTick = time
  833.  
  834. local climbFudge = 0
  835. local setAngles = false
  836.  
  837. if (jumpAnimTime > 0) then
  838. jumpAnimTime = jumpAnimTime - deltaTime
  839. end
  840.  
  841. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  842. playAnimation("fall", fallTransitionTime, Humanoid)
  843. elseif (pose == "Seated") then
  844. stopAllAnimations()
  845. moveSit()
  846. return
  847. elseif (pose == "Running") then
  848. playAnimation("walk", 0.1, Humanoid)
  849. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  850. -- print("Wha " .. pose)
  851. amplitude = 0.1
  852. frequency = 1
  853. setAngles = true
  854. end
  855.  
  856. if (setAngles) then
  857. desiredAngle = amplitude * math.sin(time * frequency)
  858.  
  859. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  860. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  861. RightHip:SetDesiredAngle(-desiredAngle)
  862. LeftHip:SetDesiredAngle(-desiredAngle)
  863. end
  864.  
  865. -- Tool Animation handling
  866. local tool = getTool()
  867. if tool then
  868.  
  869. animStringValueObject = getToolAnim(tool)
  870.  
  871. if animStringValueObject then
  872. toolAnim = animStringValueObject.Value
  873. -- message recieved, delete StringValue
  874. animStringValueObject.Parent = nil
  875. toolAnimTime = time + .3
  876. end
  877.  
  878. if time > toolAnimTime then
  879. toolAnimTime = 0
  880. toolAnim = "None"
  881. end
  882.  
  883. animateTool()
  884. else
  885. stopToolAnimations()
  886. toolAnim = "None"
  887. toolAnimTime = 0
  888. end
  889. end
  890.  
  891. -- connect events
  892. Humanoid.Died:connect(onDied)
  893. Humanoid.Running:connect(onRunning)
  894. Humanoid.Jumping:connect(onJumping)
  895. Humanoid.Climbing:connect(onClimbing)
  896. Humanoid.GettingUp:connect(onGettingUp)
  897. Humanoid.FreeFalling:connect(onFreeFall)
  898. Humanoid.FallingDown:connect(onFallingDown)
  899. Humanoid.Seated:connect(onSeated)
  900. Humanoid.PlatformStanding:connect(onPlatformStanding)
  901. Humanoid.Swimming:connect(onSwimming)
  902.  
  903. -- setup emote chat hook
  904. Game.Players.LocalPlayer.Chatted:connect(function(msg)
  905. local emote = ""
  906. if (string.sub(msg, 1, 3) == "/e ") then
  907. emote = string.sub(msg, 4)
  908. elseif (string.sub(msg, 1, 7) == "/emote ") then
  909. emote = string.sub(msg, 8)
  910. end
  911.  
  912. if (pose == "Standing" and emoteNames[emote] ~= nil) then
  913. playAnimation(emote, 0.1, Humanoid)
  914. end
  915. -- print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
  916. end)
  917.  
  918.  
  919. -- main program
  920.  
  921. local runService = game:service("RunService");
  922.  
  923. -- initialize to idle
  924. playAnimation("idle", 0.1, Humanoid)
  925. pose = "Standing"
  926.  
  927. while Figure.Parent~=nil do
  928. local _, time = wait(0.1)
  929. move(time)
  930. end
  931.  
  932.  
  933.  
  934. end
  935. coroutine.wrap(TPDDN_fake_script)()
  936. local function HIQSCP_fake_script() -- TextButton_9.LocalScript
  937. local script = Instance.new('LocalScript', TextButton_9)
  938.  
  939. script.Parent.MouseButton1Click:Connect(function()
  940. script.Parent.Parent.Visible = false
  941. end)
  942. end
  943. coroutine.wrap(HIQSCP_fake_script)()
  944. local function NFJM_fake_script() -- Annoy.Draggable
  945. local script = Instance.new('LocalScript', Annoy)
  946.  
  947. local frame = script.Parent.Parent.Annoy
  948.  
  949. frame.Draggable = true
  950. frame.Active = true
  951. end
  952. coroutine.wrap(NFJM_fake_script)()
  953. local function MSTFBEC_fake_script() -- TextButton_10.LocalScript
  954. local script = Instance.new('LocalScript', TextButton_10)
  955.  
  956. script.Parent.MouseButton1Click:Connect(function()
  957. game.Workspace.Sound:Play()
  958. end)
  959. end
  960. coroutine.wrap(MSTFBEC_fake_script)()
  961. local function XQGG_fake_script() -- TextButton_11.Animation Handler (put in workspace)
  962. local script = Instance.new('Script', TextButton_11)
  963.  
  964.  
  965.  
  966. function onPlayerEntered(newPlayer)
  967. newPlayer.Changed:connect(function (property)
  968. if (property == "Character") then
  969. onPlayerRespawned(newPlayer)
  970. end
  971. end)
  972. end
  973.  
  974. game.Players.PlayerAdded:connect(onPlayerEntered)
  975. end
  976. coroutine.wrap(XQGG_fake_script)()
  977. local function WATSQA_fake_script() -- nil.Anima
  978. local script = Instance.new('LocalScript', nil)
  979.  
  980. function waitForChild(parent, childName)
  981. local child = parent:findFirstChild(childName)
  982. if child then return child end
  983. while true do
  984. child = parent.ChildAdded:wait()
  985. if child.Name==childName then return child end
  986. end
  987. end
  988.  
  989. local Figure = script.Parent
  990. local Torso = waitForChild(Figure, "Torso")
  991. local RightShoulder = waitForChild(Torso, "Right Shoulder")
  992. local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  993. local RightHip = waitForChild(Torso, "Right Hip")
  994. local LeftHip = waitForChild(Torso, "Left Hip")
  995. local Neck = waitForChild(Torso, "Neck")
  996. local Humanoid = waitForChild(Figure, "Humanoid")
  997. local pose = "Standing"
  998.  
  999. local currentAnim = ""
  1000. local currentAnimTrack = nil
  1001. local currentAnimKeyframeHandler = nil
  1002. local currentAnimSpeed = 1.0
  1003. local oldAnimTrack = nil
  1004. local animTable = {}
  1005. local animNames = {
  1006. idle = {
  1007. { id = "rbxassetid://516957254", weight = 9 },
  1008. { id = "rbxassetid://516957254", weight = 1 }
  1009. },
  1010. walk = {
  1011. { id = "rbxassetid://125749145", weight = 10 }
  1012. },
  1013. run = {
  1014. { id = "run.xml", weight = 10 }
  1015. },
  1016. jump = {
  1017. { id = "rbxassetid://125750702", weight = 10 }
  1018. },
  1019. fall = {
  1020. { id = "rbxassetid://125750759", weight = 10 }
  1021. },
  1022. climb = {
  1023. { id = "rbxassetid://125750800", weight = 10 }
  1024. },
  1025. toolnone = {
  1026. { id = "rbxassetid://125750867", weight = 10 }
  1027. },
  1028. toolslash = {
  1029. { id = "rbxassetid://129967390", weight = 10 }
  1030. -- { id = "slash.xml", weight = 10 }
  1031. },
  1032. toollunge = {
  1033. { id = "rbxassetid://129967478", weight = 10 }
  1034. },
  1035. wave = {
  1036. { id = "rbxassetid://128777973", weight = 10 }
  1037. },
  1038. point = {
  1039. { id = "rbxassetid://128853357", weight = 10 }
  1040. },
  1041. dance = {
  1042. { id = "rbxassetid://130018893", weight = 10 },
  1043. { id = "rbxassetid://132546839", weight = 10 },
  1044. { id = "rbxassetid://132546884", weight = 10 }
  1045. },
  1046. laugh = {
  1047. { id = "rbxassetid://129423131", weight = 10 }
  1048. },
  1049. cheer = {
  1050. { id = "rbxassetid://=129423030", weight = 10 }
  1051. },
  1052. }
  1053.  
  1054. -- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
  1055. local emoteNames = { wave = false, point = false, dance = true, laugh = false, cheer = false}
  1056.  
  1057. math.randomseed(tick())
  1058.  
  1059. -- Setup animation objects
  1060. for name, fileList in pairs(animNames) do
  1061. animTable[name] = {}
  1062. animTable[name].count = 0
  1063. animTable[name].totalWeight = 0
  1064.  
  1065. -- check for config values
  1066. local config = script:FindFirstChild(name)
  1067. if (config ~= nil) then
  1068. -- print("Loading anims " .. name)
  1069. local idx = 1
  1070. for _, childPart in pairs(config:GetChildren()) do
  1071. animTable[name][idx] = {}
  1072. animTable[name][idx].anim = childPart
  1073. local weightObject = childPart:FindFirstChild("Weight")
  1074. if (weightObject == nil) then
  1075. animTable[name][idx].weight = 1
  1076. else
  1077. animTable[name][idx].weight = weightObject.Value
  1078. end
  1079. animTable[name].count = animTable[name].count + 1
  1080. animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
  1081. -- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
  1082. idx = idx + 1
  1083. end
  1084. end
  1085.  
  1086. -- fallback to defaults
  1087. if (animTable[name].count <= 0) then
  1088. for idx, anim in pairs(fileList) do
  1089. animTable[name][idx] = {}
  1090. animTable[name][idx].anim = Instance.new("Animation")
  1091. animTable[name][idx].anim.Name = name
  1092. animTable[name][idx].anim.AnimationId = anim.id
  1093. animTable[name][idx].weight = anim.weight
  1094. animTable[name].count = animTable[name].count + 1
  1095. animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
  1096. -- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
  1097. end
  1098. end
  1099. end
  1100.  
  1101. -- ANIMATION
  1102.  
  1103. -- declarations
  1104. local toolAnim = "None"
  1105. local toolAnimTime = 0
  1106.  
  1107. local jumpAnimTime = 0
  1108. local jumpAnimDuration = 0.175
  1109.  
  1110. local toolTransitionTime = 0.1
  1111. local fallTransitionTime = 0.2
  1112. local jumpMaxLimbVelocity = 0.75
  1113.  
  1114. -- functions
  1115.  
  1116. function stopAllAnimations()
  1117. local oldAnim = currentAnim
  1118.  
  1119. -- return to idle if finishing an emote
  1120. if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
  1121. oldAnim = "idle"
  1122. end
  1123.  
  1124. currentAnim = ""
  1125. if (currentAnimKeyframeHandler ~= nil) then
  1126. currentAnimKeyframeHandler:disconnect()
  1127. end
  1128.  
  1129. if (oldAnimTrack ~= nil) then
  1130. oldAnimTrack:Stop()
  1131. oldAnimTrack:Destroy()
  1132. oldAnimTrack = nil
  1133. end
  1134. if (currentAnimTrack ~= nil) then
  1135. currentAnimTrack:Stop()
  1136. currentAnimTrack:Destroy()
  1137. currentAnimTrack = nil
  1138. end
  1139. return oldAnim
  1140. end
  1141.  
  1142. function setAnimationSpeed(speed)
  1143. if speed ~= currentAnimSpeed then
  1144. currentAnimSpeed = speed
  1145. currentAnimTrack:AdjustSpeed(currentAnimSpeed)
  1146. end
  1147. end
  1148.  
  1149. function keyFrameReachedFunc(frameName)
  1150. if (frameName == "End") then
  1151. -- print("Keyframe : ".. frameName)
  1152. local repeatAnim = stopAllAnimations()
  1153. local animSpeed = currentAnimSpeed
  1154. playAnimation(repeatAnim, 0.0, Humanoid)
  1155. setAnimationSpeed(animSpeed)
  1156. end
  1157. end
  1158.  
  1159. -- Preload animations
  1160. function playAnimation(animName, transitionTime, humanoid)
  1161. if (animName ~= currentAnim) then
  1162.  
  1163. if (oldAnimTrack ~= nil) then
  1164. oldAnimTrack:Stop()
  1165. oldAnimTrack:Destroy()
  1166. end
  1167.  
  1168. currentAnimSpeed = 1.0
  1169. local roll = math.random(1, animTable[animName].totalWeight)
  1170. local origRoll = roll
  1171. local idx = 1
  1172. while (roll > animTable[animName][idx].weight) do
  1173. roll = roll - animTable[animName][idx].weight
  1174. idx = idx + 1
  1175. end
  1176. -- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
  1177. local anim = animTable[animName][idx].anim
  1178.  
  1179. -- load it to the humanoid; get AnimationTrack
  1180. oldAnimTrack = currentAnimTrack
  1181. currentAnimTrack = humanoid:LoadAnimation(anim)
  1182.  
  1183. -- play the animation
  1184. currentAnimTrack:Play(transitionTime)
  1185. currentAnim = animName
  1186.  
  1187. -- set up keyframe name triggers
  1188. if (currentAnimKeyframeHandler ~= nil) then
  1189. currentAnimKeyframeHandler:disconnect()
  1190. end
  1191. currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
  1192. end
  1193. end
  1194.  
  1195. -------------------------------------------------------------------------------------------
  1196. -------------------------------------------------------------------------------------------
  1197.  
  1198. local toolAnimName = ""
  1199. local toolOldAnimTrack = nil
  1200. local toolAnimTrack = nil
  1201. local currentToolAnimKeyframeHandler = nil
  1202.  
  1203. function toolKeyFrameReachedFunc(frameName)
  1204. if (frameName == "End") then
  1205. -- print("Keyframe : ".. frameName)
  1206. local repeatAnim = stopToolAnimations()
  1207. playToolAnimation(repeatAnim, 0.0, Humanoid)
  1208. end
  1209. end
  1210.  
  1211.  
  1212. function playToolAnimation(animName, transitionTime, humanoid)
  1213. if (animName ~= toolAnimName) then
  1214.  
  1215. if (toolAnimTrack ~= nil) then
  1216. toolAnimTrack:Stop()
  1217. toolAnimTrack:Destroy()
  1218. transitionTime = 0
  1219. end
  1220.  
  1221. local roll = math.random(1, animTable[animName].totalWeight)
  1222. local origRoll = roll
  1223. local idx = 1
  1224. while (roll > animTable[animName][idx].weight) do
  1225. roll = roll - animTable[animName][idx].weight
  1226. idx = idx + 1
  1227. end
  1228. -- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
  1229. local anim = animTable[animName][idx].anim
  1230.  
  1231. -- load it to the humanoid; get AnimationTrack
  1232. toolOldAnimTrack = toolAnimTrack
  1233. toolAnimTrack = humanoid:LoadAnimation(anim)
  1234.  
  1235. -- play the animation
  1236. toolAnimTrack:Play(transitionTime)
  1237. toolAnimName = animName
  1238.  
  1239. currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
  1240. end
  1241. end
  1242.  
  1243. function stopToolAnimations()
  1244. local oldAnim = toolAnimName
  1245.  
  1246. if (currentToolAnimKeyframeHandler ~= nil) then
  1247. currentToolAnimKeyframeHandler:disconnect()
  1248. end
  1249.  
  1250. toolAnimName = ""
  1251. if (toolAnimTrack ~= nil) then
  1252. toolAnimTrack:Stop()
  1253. toolAnimTrack:Destroy()
  1254. toolAnimTrack = nil
  1255. end
  1256.  
  1257.  
  1258. return oldAnim
  1259. end
  1260.  
  1261. -------------------------------------------------------------------------------------------
  1262. -------------------------------------------------------------------------------------------
  1263.  
  1264.  
  1265. function onRunning(speed)
  1266. if speed>0 then
  1267. playAnimation("walk", 0.1, Humanoid)
  1268. pose = "Running"
  1269. else
  1270. playAnimation("idle", 0.1, Humanoid)
  1271. pose = "Standing"
  1272. end
  1273. end
  1274.  
  1275. function onDied()
  1276. pose = "Dead"
  1277. end
  1278.  
  1279. function onJumping()
  1280. playAnimation("jump", 0.1, Humanoid)
  1281. jumpAnimTime = jumpAnimDuration
  1282. pose = "Jumping"
  1283. end
  1284.  
  1285. function onClimbing(speed)
  1286. playAnimation("climb", 0.1, Humanoid)
  1287. setAnimationSpeed(speed / 12.0)
  1288. pose = "Climbing"
  1289. end
  1290.  
  1291. function onGettingUp()
  1292. pose = "GettingUp"
  1293. end
  1294.  
  1295. function onFreeFall()
  1296. if (jumpAnimTime <= 0) then
  1297. playAnimation("fall", fallTransitionTime, Humanoid)
  1298. end
  1299. pose = "FreeFall"
  1300. end
  1301.  
  1302. function onFallingDown()
  1303. pose = "FallingDown"
  1304. end
  1305.  
  1306. function onSeated()
  1307. pose = "Seated"
  1308. end
  1309.  
  1310. function onPlatformStanding()
  1311. pose = "PlatformStanding"
  1312. end
  1313.  
  1314. function onSwimming(speed)
  1315. if speed>0 then
  1316. pose = "Running"
  1317. else
  1318. pose = "Standing"
  1319. end
  1320. end
  1321.  
  1322. function getTool()
  1323. for _, kid in ipairs(Figure:GetChildren()) do
  1324. if kid.className == "Tool" then return kid end
  1325. end
  1326. return nil
  1327. end
  1328.  
  1329. function getToolAnim(tool)
  1330. for _, c in ipairs(tool:GetChildren()) do
  1331. if c.Name == "toolanim" and c.className == "StringValue" then
  1332. return c
  1333. end
  1334. end
  1335. return nil
  1336. end
  1337.  
  1338. function animateTool()
  1339.  
  1340. if (toolAnim == "None") then
  1341. playToolAnimation("toolnone", toolTransitionTime, Humanoid)
  1342. return
  1343. end
  1344.  
  1345. if (toolAnim == "Slash") then
  1346. playToolAnimation("toolslash", 0, Humanoid)
  1347. return
  1348. end
  1349.  
  1350. if (toolAnim == "Lunge") then
  1351. playToolAnimation("toollunge", 0, Humanoid)
  1352. return
  1353. end
  1354. end
  1355.  
  1356. function moveSit()
  1357. RightShoulder.MaxVelocity = 0.15
  1358. LeftShoulder.MaxVelocity = 0.15
  1359. RightShoulder:SetDesiredAngle(3.14 /2)
  1360. LeftShoulder:SetDesiredAngle(-3.14 /2)
  1361. RightHip:SetDesiredAngle(3.14 /2)
  1362. LeftHip:SetDesiredAngle(-3.14 /2)
  1363. end
  1364.  
  1365. local lastTick = 0
  1366.  
  1367. function move(time)
  1368. local amplitude = 1
  1369. local frequency = 1
  1370. local deltaTime = time - lastTick
  1371. lastTick = time
  1372.  
  1373. local climbFudge = 0
  1374. local setAngles = false
  1375.  
  1376. if (jumpAnimTime > 0) then
  1377. jumpAnimTime = jumpAnimTime - deltaTime
  1378. end
  1379.  
  1380. if (pose == "FreeFall" and jumpAnimTime <= 0) then
  1381. playAnimation("fall", fallTransitionTime, Humanoid)
  1382. elseif (pose == "Seated") then
  1383. stopAllAnimations()
  1384. moveSit()
  1385. return
  1386. elseif (pose == "Running") then
  1387. playAnimation("walk", 0.1, Humanoid)
  1388. elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
  1389. -- print("Wha " .. pose)
  1390. amplitude = 0.1
  1391. frequency = 1
  1392. setAngles = true
  1393. end
  1394.  
  1395. if (setAngles) then
  1396. desiredAngle = amplitude * math.sin(time * frequency)
  1397.  
  1398. RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  1399. LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  1400. RightHip:SetDesiredAngle(-desiredAngle)
  1401. LeftHip:SetDesiredAngle(-desiredAngle)
  1402. end
  1403.  
  1404. -- Tool Animation handling
  1405. local tool = getTool()
  1406. if tool then
  1407.  
  1408. animStringValueObject = getToolAnim(tool)
  1409.  
  1410. if animStringValueObject then
  1411. toolAnim = animStringValueObject.Value
  1412. -- message recieved, delete StringValue
  1413. animStringValueObject.Parent = nil
  1414. toolAnimTime = time + .3
  1415. end
  1416.  
  1417. if time > toolAnimTime then
  1418. toolAnimTime = 0
  1419. toolAnim = "None"
  1420. end
  1421.  
  1422. animateTool()
  1423. else
  1424. stopToolAnimations()
  1425. toolAnim = "None"
  1426. toolAnimTime = 0
  1427. end
  1428. end
  1429.  
  1430. -- connect events
  1431. Humanoid.Died:connect(onDied)
  1432. Humanoid.Running:connect(onRunning)
  1433. Humanoid.Jumping:connect(onJumping)
  1434. Humanoid.Climbing:connect(onClimbing)
  1435. Humanoid.GettingUp:connect(onGettingUp)
  1436. Humanoid.FreeFalling:connect(onFreeFall)
  1437. Humanoid.FallingDown:connect(onFallingDown)
  1438. Humanoid.Seated:connect(onSeated)
  1439. Humanoid.PlatformStanding:connect(onPlatformStanding)
  1440. Humanoid.Swimming:connect(onSwimming)
  1441.  
  1442. -- setup emote chat hook
  1443. Game.Players.LocalPlayer.Chatted:connect(function(msg)
  1444. local emote = ""
  1445. if (string.sub(msg, 1, 3) == "/e ") then
  1446. emote = string.sub(msg, 4)
  1447. elseif (string.sub(msg, 1, 7) == "/emote ") then
  1448. emote = string.sub(msg, 8)
  1449. end
  1450.  
  1451. if (pose == "Standing" and emoteNames[emote] ~= nil) then
  1452. playAnimation(emote, 0.1, Humanoid)
  1453. end
  1454. -- print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
  1455. end)
  1456.  
  1457.  
  1458. -- main program
  1459.  
  1460. local runService = game:service("RunService");
  1461.  
  1462. -- initialize to idle
  1463. playAnimation("idle", 0.1, Humanoid)
  1464. pose = "Standing"
  1465.  
  1466. while Figure.Parent~=nil do
  1467. local _, time = wait(0.1)
  1468. move(time)
  1469. end
  1470.  
  1471.  
  1472.  
  1473. end
  1474. coroutine.wrap(WATSQA_fake_script)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement