Advertisement
AutumnMoon88683

ROBLOX Classic Animations + Classic NPC

May 2nd, 2025
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.67 KB | None | 0 0
  1. local classic = true
  2.  
  3. local function Main()
  4.     Connection = game.Workspace.DescendantAdded:Connect(function(c)
  5.         if c.Name == "Animate" then
  6.             c.Disabled=true        
  7.         end
  8.     end)
  9.     repeat wait() until game.Players.LocalPlayer.Character
  10.     Char = c
  11.     Died = game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Died:Connect(function()
  12.         Connection:Disconnect()
  13.         Died:Disconnect()
  14.     end)
  15.     wait(.1)
  16.     function waitForChild(parent, childName)
  17.         local child = parent:findFirstChild(childName)
  18.         if child then return child end
  19.         while true do
  20.             child = parent.ChildAdded:wait()
  21.             if child.Name==childName then return child end
  22.         end
  23.     end
  24.  
  25.     -- ANIMATION
  26.  
  27.     -- declarations
  28.  
  29.     local Figure = game.Players.LocalPlayer.Character
  30.     local Torso = waitForChild(Figure, "Torso")
  31.     local RightShoulder = waitForChild(Torso, "Right Shoulder")
  32.     local LeftShoulder = waitForChild(Torso, "Left Shoulder")
  33.     local RightHip = waitForChild(Torso, "Right Hip")
  34.     local LeftHip = waitForChild(Torso, "Left Hip")
  35.     local Neck = waitForChild(Torso, "Neck")
  36.     local Humanoid = waitForChild(Figure, "Humanoid")
  37.     local pose = "Standing"
  38.  
  39.     local toolAnim = "None"
  40.     local toolAnimTime = 0
  41.  
  42.     local jumpMaxLimbVelocity = 0.75
  43.  
  44.     -- functions
  45.  
  46.     function onRunning(speed)
  47.         if speed > 0.1 then
  48.             pose = "Running"
  49.         else
  50.             pose = "Standing"
  51.         end
  52.     end
  53.  
  54.     function onDied()
  55.         pose = "Dead"
  56.     end
  57.  
  58.     function onJumping()
  59.         pose = "Jumping"
  60.     end
  61.  
  62.     function onClimbing()
  63.         pose = "Climbing"
  64.     end
  65.  
  66.     function onGettingUp()
  67.         pose = "GettingUp"
  68.     end
  69.  
  70.     function onFreeFall()
  71.         pose = "FreeFall"
  72.     end
  73.  
  74.     function onFallingDown()
  75.         pose = "FallingDown"
  76.     end
  77.  
  78.     function onSeated()
  79.         pose = "Seated"
  80.     end
  81.  
  82.     function onPlatformStanding()
  83.         pose = "PlatformStanding"
  84.     end
  85.  
  86.     function onSwimming(speed)
  87.         if speed>0 then
  88.             pose = "Running"
  89.         else
  90.             pose = "Standing"
  91.         end
  92.     end
  93.  
  94.     function moveJump()
  95.         RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  96.         LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  97.         RightShoulder:SetDesiredAngle(3.14)
  98.         LeftShoulder:SetDesiredAngle(-3.14)
  99.         RightHip:SetDesiredAngle(0)
  100.         LeftHip:SetDesiredAngle(0)
  101.     end
  102.  
  103.  
  104.     -- same as jump for now
  105.  
  106.     function moveFreeFall()
  107.         RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  108.         LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  109.         RightShoulder:SetDesiredAngle(3.14)
  110.         LeftShoulder:SetDesiredAngle(-3.14)
  111.         RightHip:SetDesiredAngle(0)
  112.         LeftHip:SetDesiredAngle(0)
  113.     end
  114.  
  115.     function moveSit()
  116.         RightShoulder.MaxVelocity = 0.15
  117.         LeftShoulder.MaxVelocity = 0.15
  118.         RightShoulder:SetDesiredAngle(3.14 /2)
  119.         LeftShoulder:SetDesiredAngle(-3.14 /2)
  120.         RightHip:SetDesiredAngle(3.14 /2)
  121.         LeftHip:SetDesiredAngle(-3.14 /2)
  122.     end
  123.  
  124.     function getTool()
  125.         for _, kid in ipairs(Figure:GetChildren()) do
  126.             if kid.className == "Tool" then return kid end
  127.         end
  128.         return nil
  129.     end
  130.  
  131.     function getToolAnim(tool)
  132.         for _, c in ipairs(tool:GetChildren()) do
  133.             if c.Name == "toolanim" and c.className == "StringValue" then
  134.                 return c
  135.             end
  136.         end
  137.         return nil
  138.     end
  139.  
  140.     function animateTool()
  141.  
  142.         if (toolAnim == "None") then
  143.             RightShoulder:SetDesiredAngle(1.57)
  144.             return
  145.         end
  146.  
  147.         if (toolAnim == "Slash") then
  148.             RightShoulder.MaxVelocity = 0.5
  149.             RightShoulder:SetDesiredAngle(0)
  150.             return
  151.         end
  152.  
  153.         if (toolAnim == "Lunge") then
  154.             RightShoulder.MaxVelocity = 0.5
  155.             LeftShoulder.MaxVelocity = 0.5
  156.             RightHip.MaxVelocity = 0.5
  157.             LeftHip.MaxVelocity = 0.5
  158.             RightShoulder:SetDesiredAngle(1.57)
  159.             LeftShoulder:SetDesiredAngle(1.0)
  160.             RightHip:SetDesiredAngle(1.57)
  161.             LeftHip:SetDesiredAngle(1.0)
  162.             return
  163.         end
  164.     end
  165.  
  166.     function move(time)
  167.         local amplitude
  168.         local frequency
  169.  
  170.         if (pose == "Jumping") then
  171.             moveJump()
  172.             return
  173.         end
  174.  
  175.         if (pose == "FreeFall") then
  176.             moveFreeFall()
  177.             return
  178.         end
  179.  
  180.         if (pose == "Seated") then
  181.             moveSit()
  182.             return
  183.         end
  184.  
  185.         local climbFudge = 0
  186.  
  187.         if (pose == "Running") then
  188.             if (RightShoulder.CurrentAngle > 1.5 or RightShoulder.CurrentAngle < -1.5) then
  189.                 RightShoulder.MaxVelocity = jumpMaxLimbVelocity
  190.             else  
  191.                 RightShoulder.MaxVelocity = 0.15
  192.             end
  193.             if (LeftShoulder.CurrentAngle > 1.5 or LeftShoulder.CurrentAngle < -1.5) then
  194.                 LeftShoulder.MaxVelocity = jumpMaxLimbVelocity
  195.             else  
  196.                 LeftShoulder.MaxVelocity = 0.15
  197.             end
  198.             amplitude = 1
  199.             frequency = 9
  200.         elseif (pose == "Climbing") then
  201.             RightShoulder.MaxVelocity = 0.5
  202.             LeftShoulder.MaxVelocity = 0.5
  203.             amplitude = 1
  204.             frequency = 9
  205.             climbFudge = 3.14
  206.         else
  207.             amplitude = 0.1
  208.             frequency = 1
  209.         end
  210.  
  211.         desiredAngle = amplitude * math.sin(time*frequency)
  212.  
  213.         RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
  214.         LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
  215.         RightHip:SetDesiredAngle(-desiredAngle)
  216.         LeftHip:SetDesiredAngle(-desiredAngle)
  217.  
  218.  
  219.         local tool = getTool()
  220.  
  221.         if tool then
  222.  
  223.             animStringValueObject = getToolAnim(tool)
  224.  
  225.             if animStringValueObject then
  226.                 toolAnim = animStringValueObject.Value
  227.                 -- message recieved, delete StringValue
  228.                 animStringValueObject.Parent = nil
  229.                 toolAnimTime = time + .3
  230.             end
  231.  
  232.             if time > toolAnimTime then
  233.                 toolAnimTime = 0
  234.                 toolAnim = "None"
  235.             end
  236.  
  237.             animateTool()
  238.  
  239.  
  240.         else
  241.             toolAnim = "None"
  242.             toolAnimTime = 0
  243.         end
  244.     end
  245.  
  246.  
  247.     -- connect events
  248.  
  249.     Humanoid.Died:connect(onDied)
  250.     Humanoid.Running:connect(onRunning)
  251.     Humanoid.Jumping:connect(onJumping)
  252.     Humanoid.Climbing:connect(onClimbing)
  253.     Humanoid.GettingUp:connect(onGettingUp)
  254.     Humanoid.FreeFalling:connect(onFreeFall)
  255.     Humanoid.FallingDown:connect(onFallingDown)
  256.     Humanoid.Seated:connect(onSeated)
  257.     Humanoid.PlatformStanding:connect(onPlatformStanding)
  258.     Humanoid.Swimming:connect(onSwimming)
  259.     -- main program
  260.  
  261.     local runService = game:service("RunService");
  262.  
  263.     while Figure.Parent ~= nil do
  264.         local _, time = wait(0.1)
  265.         move(time)
  266.     end
  267. end
  268.  
  269. game.Players.LocalPlayer.CharacterAdded:Connect(function(c)
  270.     if classic then
  271.         coroutine.wrap(Main)()
  272.     end
  273. end)
  274.  
  275. local bot = false
  276. local d = game:GetService("UserInputService")
  277.  
  278. d.InputBegan:Connect(function(c,v)
  279.     if v then
  280.         return
  281.     else       
  282.         if c.KeyCode == Enum.KeyCode.KeypadFive then
  283.             bot = not bot
  284.             print("ClassicBotMode:"..tostring(bot))
  285.         elseif c.KeyCode == Enum.KeyCode.KeypadSix then
  286.             classic = not classic
  287.             print("ClassicAnims:"..tostring(classic))  
  288.            
  289.         end
  290.     end
  291. end)
  292.  
  293. while wait() do
  294.     if bot then
  295.         local c = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
  296.         wait(math.random(1,7))
  297.         if math.random(1,5) > 2.5 then
  298.             c:FindFirstChild("Humanoid").Jump = true
  299.         end
  300.         c:FindFirstChild("Humanoid").WalkToPoint = Vector3.new(math.random(1,2),math.random(1,2),math.random(1,2))
  301.     end
  302. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement