R6 For Brookhaven
R6 For Brookhaven
LocalPlayer
function RunCustomAnimation(Char)
      if Char:WaitForChild("Animate") ~= nil then
            Char.Animate.Disabled = true
      end
Char:WaitForChild("Humanoid")
     --fake script
     local script = Char.Animate
      local AnimationSpeedDampeningObject =
script:FindFirstChild("ScaleDampeningPercent")
      local HumanoidHipHeight = 2
local PreloadedAnims = {}
     local animTable = {}
     local animNames = {
           idle =      {
                 { id = "http://www.roblox.com/asset/?id=12521158637", weight =
9 },
               { id = "http://www.roblox.com/asset/?id=12521162526", weight =
1 },
       },
       walk =      {
             { id = "http://www.roblox.com/asset/?id=12518152696", weight = 10
}
       },
       run =         {
               { id = "http://www.roblox.com/asset/?id=12518152696", weight = 10
}
       },
       jump =      {
             { id = "http://www.roblox.com/asset/?id=12520880485", weight = 10
}
       },
       fall =      {
             { id = "http://www.roblox.com/asset/?id=12520972571", weight = 10
}
       },
       climb = {
             { id = "http://www.roblox.com/asset/?id=12520982150", weight = 10
}
       },
       sit =         {
               { id = "http://www.roblox.com/asset/?id=12520993168", weight = 10
}
       },
       toolnone = {
             { id = "http://www.roblox.com/asset/?id=12520996634", weight = 10
}
       },
       toolslash = {
             { id = "http://www.roblox.com/asset/?id=12520999032", weight = 10
}
       },
       toollunge = {
             { id = "http://www.roblox.com/asset/?id=12521002003", weight = 10
}
       },
       wave = {
             { id = "http://www.roblox.com/asset/?id=12521004586", weight = 10
}
       },
       point = {
             { id = "http://www.roblox.com/asset/?id=12521007694", weight = 10
}
       },
       dance = {
             { id = "http://www.roblox.com/asset/?id=12521009666", weight = 10
},
               { id = "http://www.roblox.com/asset/?id=12521151637", weight = 10
},
               { id = "http://www.roblox.com/asset/?id=12521015053", weight = 10
}
       },
       dance2 = {
             { id = "http://www.roblox.com/asset/?id=12521169800", weight = 10
},
                 { id = "http://www.roblox.com/asset/?id=12521173533", weight = 10
},
                 { id = "http://www.roblox.com/asset/?id=12521027874", weight = 10
}
           },
           dance3 = {
                 { id = "http://www.roblox.com/asset/?id=12521178362", weight = 10
},
                 { id = "http://www.roblox.com/asset/?id=12521181508", weight = 10
},
                 { id = "http://www.roblox.com/asset/?id=12521184133", weight = 10
}
           },
           laugh = {
                 { id = "http://www.roblox.com/asset/?id=12521018724", weight = 10
}
           },
           cheer = {
                 { id = "http://www.roblox.com/asset/?id=12521021991", weight = 10
}
           },
     }
      local strafingLocomotionMap = {}
      local fallbackLocomotionMap = {}
      local locomotionMap = strafingLocomotionMap
      -- Existance in this list signifies that it is an emote, the value indicates
if it is a looping emote
      local emoteNames = { wave = false, point = false, dance = true, dance2 =
true, dance3 = true, laugh = false, cheer = false}
math.randomseed(tick())
           return 0
     end
local idx = 0
                        if lv then
                             fallbackLocomotionMap[name] =
strafingLocomotionMap[name]
                        else
                             local speed = name == "run" and RUN_SPEED or WALK_SPEED
                             fallbackLocomotionMap[name] = {lv=Vector2.new(0.0,
speed), speed = speed}
                             locomotionMap = fallbackLocomotionMap
                             -- If you don't have a linear velocity with your run or
walk, you can't blend/strafe
                             --warn("Strafe blending disabled. No linear velocity
information for "..'"'.."walk"..'"'.." and "..'"'.."run"..'"'..".")
                        end
                      end
                end
               end
         end
         ]]
               -- fallback to defaults
               if (animTable[name].count <= 0) then
                     for idx, anim in pairs(fileList) do
                           animTable[name][idx] = {}
                           animTable[name][idx].anim = Instance.new("Animation")
                           animTable[name][idx].anim.Name = name
                           animTable[name][idx].anim.AnimationId = anim.id
                           animTable[name][idx].weight = anim.weight
                           animTable[name].count = animTable[name].count + 1
                           animTable[name].totalWeight = animTable[name].totalWeight +
anim.weight
                     end
               end
               -- preload anims
               for i, animType in pairs(animTable) do
                     for idx = 1, animType.count, 1 do
                           if PreloadedAnims[animType[idx].anim.AnimationId] == nil
then
                                 Humanoid:LoadAnimation(animType[idx].anim)
                                 PreloadedAnims[animType[idx].anim.AnimationId] = true
                           end
                     end
               end
       end
       script.ChildAdded:connect(scriptChildModified)
       script.ChildRemoved:connect(scriptChildModified)
      -- Clear any existing animation tracks
      -- Fixes issue with characters that are moved in and out of the Workspace
accumulating tracks
      local animator = if Humanoid then Humanoid:FindFirstChildOfClass("Animator")
else nil
      if animator then
            local animTracks = animator:GetPlayingAnimationTracks()
            for i,track in ipairs(animTracks) do
                  track:Stop(0)
                  track:Destroy()
            end
      end
-- ANIMATION
     -- declarations
     local toolAnim = "None"
     local toolAnimTime = 0
     local jumpAnimTime = 0
     local jumpAnimDuration = 0.31
-- functions
     function stopAllAnimations()
           local oldAnim = currentAnim
           if currentlyPlayingEmote then
                 oldAnim = "idle"
                 currentlyPlayingEmote = false
           end
           currentAnim = ""
           currentAnimInstance = nil
           if (currentAnimKeyframeHandler ~= nil) then
                 currentAnimKeyframeHandler:disconnect()
           end
           return oldAnim
     end
     function getHeightScale()
           if Humanoid then
                 if not Humanoid.AutomaticScalingEnabled then
                       return 1
                 end
end
local tempDir
     function setAnimationSpeed(speed)
           if currentAnim ~= "walk" then
                 if speed ~= currentAnimSpeed then
                       currentAnimSpeed = speed
                       currentAnimTrack:AdjustSpeed(currentAnimSpeed)
                 end
           end
     end
      function keyFrameReachedFunc(frameName)
            if (frameName == "End") then
                  local repeatAnim = currentAnim
                  -- return to idle if finishing an emote
                  if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] ==
false) then
                        repeatAnim = "idle"
                  end
                 if currentlyPlayingEmote then
                       if currentAnimTrack.Looped then
                             -- Allow the emote to loop
                             return
                    end
                    repeatAnim = "idle"
                    currentlyPlayingEmote = false
            end
function rollAnimation(animName)
      local roll = math.random(1, animTable[animName].totalWeight)
      local origRoll = roll
      local idx = 1
      while (roll > animTable[animName][idx].weight) do
            roll = roll - animTable[animName][idx].weight
            idx = idx + 1
      end
      return idx
end
currentAnimSpeed = 1.0
                  currentAnim = animName
                  currentAnimInstance = anim    -- nil in the case of locomotion
currentAnimTrack:Play(transitionTime)
      -----------------------------------------------------------------------------
--------------
      -----------------------------------------------------------------------------
--------------
     function toolKeyFrameReachedFunc(frameName)
           if (frameName == "End") then
                 playToolAnimation(toolAnimName, 0.0, Humanoid)
           end
     end
                  currentToolAnimKeyframeHandler =
toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
            end
      end
     function stopToolAnimations()
           local oldAnim = toolAnimName
           toolAnimName = ""
           toolAnimInstance = nil
           if (toolAnimTrack ~= nil) then
                 toolAnimTrack:Stop()
                 toolAnimTrack:Destroy()
                 toolAnimTrack = nil
           end
           return oldAnim
     end
      -----------------------------------------------------------------------------
--------------
      -----------------------------------------------------------------------------
--------------
      -- STATE CHANGE HANDLERS
      function onRunning(speed)
            local movedDuringEmote = currentlyPlayingEmote and
Humanoid.MoveDirection == Vector3.new(0, 0, 0)
            local speedThreshold = movedDuringEmote and Humanoid.WalkSpeed or 0.75
            humanoidSpeed = speed
            if speed > speedThreshold then
                  playAnimation("walk", 0.2, Humanoid)
                  if pose ~= "Running" then
                        pose = "Running"
                        updateVelocity(0) -- Force velocity update in response to
state change
                  end
            else
                  if emoteNames[currentAnim] == nil and not currentlyPlayingEmote
then
                        playAnimation("idle", 0.2, Humanoid)
                        pose = "Standing"
                  end
            end
end
     function onDied()
           pose = "Dead"
     end
     function onJumping()
           playAnimation("jump", 0.1, Humanoid)
           jumpAnimTime = jumpAnimDuration
           pose = "Jumping"
     end
     function onClimbing(speed)
           local scale = 5.0
           playAnimation("climb", 0.1, Humanoid)
           setAnimationSpeed(speed / scale)
           pose = "Climbing"
     end
     function onGettingUp()
           pose = "GettingUp"
     end
     function onFreeFall()
           if (jumpAnimTime <= 0) then
                 playAnimation("fall", fallTransitionTime, Humanoid)
           end
           pose = "FreeFall"
     end
     function onFallingDown()
           pose = "FallingDown"
     end
     function onSeated()
           pose = "Seated"
     end
     function onPlatformStanding()
           pose = "PlatformStanding"
     end
      -----------------------------------------------------------------------------
--------------
      -----------------------------------------------------------------------------
--------------
     function onSwimming(speed)
           if speed > 0 then
                 pose = "Running"
           else
                 pose = "Standing"
           end
     end
      function animateTool()
            if (toolAnim == "None") then
                  playToolAnimation("toolnone", toolTransitionTime, Humanoid,
Enum.AnimationPriority.Idle)
                  return
            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
local lastTick = 0
     function stepAnimate(currentTime)
           local amplitude = 1
           local frequency = 1
           local deltaTime = currentTime - lastTick
           lastTick = currentTime
           local climbFudge = 0
           local setAngles = false
                 if animStringValueObject then
                       toolAnim = animStringValueObject.Value
                       -- message recieved, delete StringValue
                       animStringValueObject.Parent = nil
                       toolAnimTime = currentTime + .3
                 end
-- connect events
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)
RunCustomAnimation(plr.Character)
plr.CharacterAdded:Connect(function(Char)
      RunCustomAnimation(Char)
end)