Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Complete functional 2008 like Animate script + more old 2008 movement functions!
- --this includes some old coding from the original classic animation script
- --originally only works as localscript but had to edit it to work on void sb
- --this actually is just a test but you can use it anyway
- --//.-.\\
- --Remade by Protofer_S
- --\\.-.//
- -- util
- function waitForChild(parent, childName)
- while true do
- local child = parent:findFirstChild(childName)
- if child then
- return child
- end
- parent.ChildAdded:wait()
- end
- end
- function newSound(id,Parent1)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.Parent = Parent1
- return sound
- end
- -- declarations
- local Figure = owner.Character
- local Torso = waitForChild(Figure, "Torso")
- local Humanoid = Figure:FindFirstChildOfClass("Humanoid")
- Humanoid:ClearAllChildren()
- Humanoid.RequiresNeck=false
- Instance.new("Animator",Humanoid).Name="Animator"
- local oldanim = Figure:FindFirstChild("Animate")
- if oldanim then oldanim.Disabled=true end
- local sDied = newSound("rbxasset://sounds/uuhhh.wav",Torso)
- local sFallingDown = newSound("rbxasset://sounds/splat.wav",Torso)
- local sFreeFalling = newSound("rbxasset://sounds/button.wav",Torso)
- local sGettingUp = newSound("rbxasset://sounds/hit.wav",Torso)
- local sJumping = newSound("rbxasset://sounds/button.wav",Torso)
- local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3",Torso)
- sRunning.Looped = true
- -- functions
- function onDied()
- sDied:play()
- end
- function onState(state, sound)
- if state then
- sound:play()
- else
- sound:pause()
- end
- end
- function onRunning(speed)
- if speed>0 then
- sRunning:play()
- else
- sRunning:pause()
- end
- end
- -- connect up
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
- Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
- Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
- Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
- function makeJoint(limbName, jointName, c0, c1)
- local limb = waitForChild(Figure, limbName)
- if limb.Name=="Head" then
- else
- limb:BreakJoints()
- end
- local joint = Instance.new"Motor"
- joint.Name = jointName
- joint.Part0 = Torso
- joint.Part1 = limb
- joint.C0 = c0
- joint.C1 = c1
- joint.MaxVelocity = 0.5
- joint.archivable = true
- joint.Parent = Torso
- return joint
- end
- local Neck = makeJoint("Head","Neck", CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0))
- local RightShoulder = makeJoint("Right Arm", "Right Shoulder", CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
- local LeftShoulder = makeJoint("Left Arm", "Left Shoulder", CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
- local RightHip = makeJoint("Right Leg", "Right Hip", CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0))
- local LeftHip = makeJoint("Left Leg", "Left Hip", CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0))
- NLS([[
- function newSound(id,Parent1)
- local sound = Instance.new("Sound")
- sound.SoundId = id
- sound.Parent = Parent1
- return sound
- end
- local Player = game:GetService("Players").LocalPlayer
- local Figure = Player.Character
- local Torso = Figure:WaitForChild("Torso")
- local Lefthip = Torso:WaitForChild("Left Hip")
- local Righthip = Torso:WaitForChild("Right Hip")
- local Humanoid = Figure:FindFirstChildOfClass("Humanoid")
- local Rightshoulder = Torso:WaitForChild("Right Shoulder")
- local Leftshoulder = Torso:WaitForChild("Left Shoulder")
- local walkspeed = Humanoid.WalkSpeed
- local P = game:GetService("PathfindingService")
- local movespeed = 1
- local jumpMaxLimbVelocity = 0.5
- local ANGLE = 10
- local FPS = 0.05
- local canjump=true
- local removing = game.DescendantRemoving
- local Mouse = Player:GetMouse()
- local MAINDISK = nil
- local moveto = nil
- local newpath = false
- local oldpath
- local pathwait
- local usingtool = false
- local Pose = "standing"
- local sDied = newSound("rbxasset://sounds/uuhhh.wav",Torso)
- local sFallingDown = newSound("rbxasset://sounds/splat.wav",Torso)
- local sFreeFalling = newSound("rbxasset://sounds/button.wav",Torso)
- local sGettingUp = newSound("rbxasset://sounds/hit.wav",Torso)
- local sJumping = newSound("rbxasset://sounds/button.wav",Torso)
- local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3",Torso)
- sRunning.Looped = true
- function clickmovement(END)
- if usingtool then return end
- if not newpath then
- newpath=true
- END = Mouse.Hit.p
- moveto = createdisk()
- moveto.Position = END
- moveto.Orientation = Vector3.new(0,0,90)
- local path = P:CreatePath()
- path:ComputeAsync(Torso.Position, END)
- local waypoints = path:GetWaypoints()
- if path.Status == Enum.PathStatus.Success then
- for _, waypoint in pairs(waypoints) do
- if waypoint.Action == Enum.PathWaypointAction.Jump then
- Humanoid.Jump = true
- end
- if newpath then
- Humanoid:MoveTo(waypoint.Position)
- Humanoid.MoveToFinished:Wait()
- else
- Humanoid:MoveTo(Torso.Position)
- end
- end
- end
- newpath=false
- moveto:Destroy()
- else
- newpath=false
- if moveto~=nil then
- moveto:Destroy()
- end
- Humanoid:MoveTo(Torso.Position)
- end
- end
- function diskpos()
- if MAINDISK~=nil then
- MAINDISK.CFrame = Mouse.Hit
- MAINDISK.Orientation = Vector3.new(0, 0, 90)
- local TOOL = 0
- for i,v in pairs(Player.Backpack:children()) do
- if v:IsA'HopperBin' and v.Active==true then
- TOOL=TOOL+1
- end
- end
- for i,v in pairs(Player.Character:children()) do
- if v:IsA'Tool' then
- TOOL=TOOL+1
- end
- end
- if TOOL~=0 then
- usingtool=true
- if MAINDISK.Parent~=nil then
- MAINDISK.Transparency=1
- end
- else
- if MAINDISK.Parent~=nil then
- MAINDISK.Transparency=0
- end
- usingtool=false
- end
- end
- end
- function createdisk()
- wait()
- local Disc = Instance.new("Part", Figure)
- if usingtool then
- Disc.Transparency=1
- end
- Disc.Shape = "Cylinder"
- Disc.Size = Vector3.new(0.5, 3.5, 2.5)
- Disc.TopSurface = Enum.SurfaceType.Smooth
- Disc.BottomSurface = Enum.SurfaceType.Smooth
- Disc.Anchored = true
- Disc.CanCollide = false
- Disc.BrickColor = BrickColor.new("Lime green")
- return Disc
- end
- MAINDISK = createdisk()
- local rem = removing:Connect(function(ob)
- if ob==MAINDISK then
- MAINDISK = createdisk()
- end
- end)
- function jumpcooldown(velocity)
- coroutine.resume(coroutine.create(function()
- if canjump then
- local oldpower = Humanoid.JumpPower
- canjump=false
- while wait() do
- if Pose~="falling" and Pose~="jumping" then
- break
- else
- if not canjump then
- Humanoid.JumpPower=0
- end
- end
- end
- wait(.5)
- Humanoid.JumpPower = oldpower
- canjump=true
- end
- end))
- end
- function moveJump()
- Rightshoulder.MaxVelocity = jumpMaxLimbVelocity
- Leftshoulder.MaxVelocity = jumpMaxLimbVelocity
- Rightshoulder:SetDesiredAngle(3.14)
- Leftshoulder:SetDesiredAngle(-3.14)
- Righthip:SetDesiredAngle(0)
- Lefthip:SetDesiredAngle(0)
- end
- function moveFreeFall()
- Rightshoulder.MaxVelocity = jumpMaxLimbVelocity
- Leftshoulder.MaxVelocity = jumpMaxLimbVelocity
- Rightshoulder:SetDesiredAngle(3.14)
- Leftshoulder:SetDesiredAngle(-3.14)
- Righthip:SetDesiredAngle(0)
- Lefthip:SetDesiredAngle(0)
- end
- function moveclimb(desiredangle,climbangle)
- Leftshoulder.MaxVelocity=jumpMaxLimbVelocity
- Rightshoulder.MaxVelocity=jumpMaxLimbVelocity
- Lefthip:SetDesiredAngle(-desiredangle*6.65)
- Righthip:SetDesiredAngle(-desiredangle*6.65)
- Leftshoulder:SetDesiredAngle(desiredangle*6.5-climbangle)
- Rightshoulder:SetDesiredAngle(desiredangle*6.5+climbangle)
- end
- function moveSit()
- Rightshoulder.MaxVelocity = 0.15
- Leftshoulder.MaxVelocity = 0.15
- Rightshoulder:SetDesiredAngle(3.14 /2)
- Leftshoulder:SetDesiredAngle(-3.14 /2)
- Righthip:SetDesiredAngle(3.14 /2)
- Lefthip:SetDesiredAngle(-3.14 /2)
- end
- function getTool()
- for _, kid in ipairs(Figure:GetChildren()) do
- if kid.className == "Tool" then return kid end
- end
- return nil
- end
- function getToolAnim(tool)
- for _, c in ipairs(tool:GetChildren()) do
- if c.Name == "toolanim" and c.className == "StringValue" then
- return c
- end
- end
- return nil
- end
- function animateTool()
- if (toolAnim == "None") then
- Rightshoulder:SetDesiredAngle(1.57)
- return
- end
- if (toolAnim == "Slash") then
- Rightshoulder.MaxVelocity = 0.5
- Rightshoulder:SetDesiredAngle(0)
- return
- end
- if (toolAnim == "Lunge") then
- Rightshoulder.MaxVelocity = 0.5
- Leftshoulder.MaxVelocity = 0.5
- Righthip.MaxVelocity = 0.5
- Lefthip.MaxVelocity = 0.5
- Rightshoulder:SetDesiredAngle(1.57)
- Leftshoulder:SetDesiredAngle(1.0)
- Righthip:SetDesiredAngle(1.57)
- Lefthip:SetDesiredAngle(1.0)
- return
- end
- end
- function Move(desiredangle,time)
- if Pose=="jumping" then
- moveJump()
- return
- end
- if Pose=="falling" then
- moveFreeFall()
- return
- end
- if Pose=="climbing" then
- moveclimb(desiredangle,math.rad(180))
- return
- end
- if Pose=="sitting" then
- moveSit()
- return
- end
- if Pose=="running" or Pose=="climbing" or Pose=="falling" then
- local anglespeed = 0.2 - walkspeed*0.005
- if anglespeed>0.01 then
- movespeed=anglespeed
- FPS=0.05
- else
- movespeed=0.01
- FPS=0
- end
- end
- if Pose=="running" then
- ANGLE=9.5
- Lefthip:SetDesiredAngle(-desiredangle*6.65)
- Righthip:SetDesiredAngle(-desiredangle*6.65)
- Leftshoulder:SetDesiredAngle(desiredangle*6.5+desiredangle)
- Rightshoulder:SetDesiredAngle(desiredangle*6.5+desiredangle)
- --Lefthip.DesiredAngle = -desiredangle*6.65+desiredangle
- --Righthip.DesiredAngle = -desiredangle*6.65+desiredangle
- --Rightshoulder.DesiredAngle = desiredangle*6.5+desiredangle
- --Leftshoulder.DesiredAngle = desiredangle*6.5+desiredangle
- if (Rightshoulder.CurrentAngle > 1.5 or Rightshoulder.CurrentAngle < -1.5) then
- Rightshoulder.MaxVelocity = 0.1
- else
- if movespeed>-0.01 then
- Rightshoulder.MaxVelocity = 0.15
- Righthip.MaxVelocity = 0.2
- else
- Righthip.MaxVelocity = .7
- Rightshoulder.MaxVelocity = .7
- end
- end
- if (Leftshoulder.CurrentAngle > 1.5 or Leftshoulder.CurrentAngle < -1.5) then
- Leftshoulder.MaxVelocity = 0.1
- else
- if movespeed>-0.01 then
- Leftshoulder.MaxVelocity = 0.15
- Lefthip.MaxVelocity = 0.2
- else
- Lefthip.MaxVelocity = .7
- Leftshoulder.MaxVelocity = .7
- end
- end
- end
- if Pose=="standing" or Pose=="platformstand" then
- if (Rightshoulder.CurrentAngle > 1.5 or Rightshoulder.CurrentAngle < -1.5) then
- Rightshoulder.MaxVelocity = 0.25
- end
- if (Leftshoulder.CurrentAngle > 1.5 or Leftshoulder.CurrentAngle < -1.5) then
- Leftshoulder.MaxVelocity = 0.25
- end
- ANGLE=10
- movespeed = 1
- Lefthip.DesiredAngle = -desiredangle
- Righthip.DesiredAngle = -desiredangle
- Rightshoulder.DesiredAngle = desiredangle
- Leftshoulder.DesiredAngle = desiredangle
- end
- local tool = getTool()
- if tool then
- animStringValueObject = getToolAnim(tool)
- if animStringValueObject then
- toolAnim = animStringValueObject.Value
- -- message recieved, delete StringValue
- animStringValueObject.Parent = nil
- toolAnimTime = time+.3
- end
- if time > toolAnimTime then
- toolAnimTime = 0
- toolAnim = "None"
- end
- animateTool()
- else
- toolAnim = "None"
- toolAnimTime = 0
- end
- end
- function onSeated()
- Pose="sitting"
- end
- function onRunning(speed)
- local Torsovelocity = (Torso.Velocity * Vector3.new(1,0,1)).magnitude
- if speed>0 then
- Pose="running"
- --sRunning:play()
- else
- movespeed=1
- Pose="standing"
- --sRunning:pause()
- end
- end
- function onDied()
- Pose="died"
- --sDied:play()
- end
- function onJumping()
- Pose="jumping"
- end
- function onClimbing()
- Pose="climbing"
- end
- function onGettingUp()
- Pose="standingup"
- end
- function onFreeFall()
- Pose="falling"
- end
- function onFallingDown()
- Pose="falling"
- end
- function onPlatformStanding()
- Pose="platformstand"
- end
- function onSwimming()
- Pose="swimming"
- end
- Humanoid.Died:connect(onDied)
- Humanoid.Running:connect(onRunning)
- Humanoid.Jumping:connect(onJumping)
- Humanoid.Climbing:connect(onClimbing)
- Humanoid.GettingUp:connect(onGettingUp)
- Humanoid.FreeFalling:connect(onFreeFall)
- Humanoid.FallingDown:connect(onFallingDown)
- Humanoid.Seated:connect(onSeated)
- Humanoid.PlatformStanding:connect(onPlatformStanding)
- Humanoid.Swimming:connect(onSwimming)
- Mouse.Button1Down:Connect(clickmovement)
- --sound functions
- function onState(state, sound)
- if state then
- sound:play()
- else
- sound:pause()
- end
- end
- --Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
- --Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
- --Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
- --Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
- while true do
- local _, time = wait(FPS)
- if Figure.Parent~=nil then else
- rem:Disconnect() break
- end
- local jumpVelocity = Torso.Velocity.y
- walkspeed = Humanoid.WalkSpeed
- local angle = math.sin(-tick()/movespeed)/ANGLE
- Move(angle,time)
- if jumpVelocity>5 then
- jumpcooldown(jumpVelocity)
- end
- diskpos()
- end
- ]],owner.Character)
Add Comment
Please, Sign In to add comment