--R6 animations for R15 Characters without Reanimation!
--This is a script that roblox made (Script location: content\avatar\unification\humanoidClassicAnimate.lua) but I edited for it to work with exploits and etc.
-- speed most recently sent to us from onRunning()
local
0
-- The most recent speed used to compute blends. Tiny variations from cachedRunningSpeed will not cause animation updates.
local
0.0
0.0
-- unit 2D object space direction of motion
local
0.0001
-- We want weights to be small but not so small the animation stops
local
0.2
local
Vector3
new
0.0
0.0
0.0
-- used to track whether rootPart orientation is changing.
local
0
-- The last time we blended velocities
local
6.4
local
12.8
local
0.1
local
""
local
nil
local
nil
local
nil
local
1.0
local
local
local
"http://www.roblox.com/asset/?id=12521158637"
9
"http://www.roblox.com/asset/?id=12521162526"
1
"http://www.roblox.com/asset/?id=12518152696"
10
"http://www.roblox.com/asset/?id=12518152696"
10
"http://www.roblox.com/asset/?id=12520880485"
10
"http://www.roblox.com/asset/?id=12520972571"
10
"http://www.roblox.com/asset/?id=12520982150"
10
"http://www.roblox.com/asset/?id=12520993168"
10
"http://www.roblox.com/asset/?id=12520996634"
10
"http://www.roblox.com/asset/?id=12520999032"
10
"http://www.roblox.com/asset/?id=12521002003"
10
"http://www.roblox.com/asset/?id=12521004586"
10
"http://www.roblox.com/asset/?id=12521007694"
10
"http://www.roblox.com/asset/?id=12521009666"
10
"http://www.roblox.com/asset/?id=12521151637"
10
"http://www.roblox.com/asset/?id=12521015053"
10
"http://www.roblox.com/asset/?id=12521169800"
10
"http://www.roblox.com/asset/?id=12521173533"
10
"http://www.roblox.com/asset/?id=12521027874"
10
"http://www.roblox.com/asset/?id=12521178362"
10
"http://www.roblox.com/asset/?id=12521181508"
10
"http://www.roblox.com/asset/?id=12521184133"
10
"http://www.roblox.com/asset/?id=12521018724"
10
"http://www.roblox.com/asset/?id=12521021991"
10
local
local
local
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
local
false
false
true
true
true
false
false
math
randomseed
tick
function
findExistingAnimationInSet
if
nil
or
nil
then
return
0
end
for
1
1
do
if
then
return
end
end
return
0
end
function
configureAnimationSet
if
nil
then
for
in
pairs
do
disconnect
end
end
0
0
-- uncomment this section to allow players to load with their
-- own (non-classic) animations
--[[
local config = script:FindFirstChild(name)
if (config ~= nil) then
table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 0
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
local newWeight = 1
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject ~= nil) then
newWeight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
idx = animTable[name].count
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
animTable[name][idx].weight = newWeight
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, childPart.ChildAdded:connect(function(property) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, childPart.ChildRemoved:connect(function(property) configureAnimationSet(name, fileList) end))
local lv = childPart:GetAttribute("LinearVelocity")
if lv then
strafingLocomotionMap[name] = {lv=lv, speed = lv.Magnitude}
end
if name == "run" or name == "walk" then
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
]]
-- if you uncomment the above section, comment out this "if"-block
if
"run"
or
"walk"
then
local
"run"
and
or
Vector2
new
0.0
-- 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
-- fallback to defaults
if
0
then
for
in
pairs
do
Instance
new
"Animation"
1
end
end
-- preload anims
for
in
pairs
do
for
1
1
do
if
nil
then
LoadAnimation
true
end
end
end
end
-- Setup animation objects
function
scriptChildModified
local
if
nil
then
configureAnimationSet
else
if
isA
"StringValue"
then
configureAnimationSet
end
end
end
script
connect
script
connect
-- Clear any existing animation tracks
-- Fixes issue with characters that are moved in and out of the Workspace accumulating tracks
local
if
then
FindFirstChildOfClass
"Animator"
else
nil
if
then
local
GetPlayingAnimationTracks
for
in
ipairs
do
Stop
0
Destroy
end
end
for
in
pairs
do
configureAnimationSet
end
for
in
script
GetChildren
do
if
isA
"StringValue"
and
not
then
configureAnimationSet
end
end
-- ANIMATION
-- declarations
local
"None"
local
0
local
0
local
0.31
local
0.1
local
0.2
local
false
-- functions
function
stopAllAnimations
local
-- return to idle if finishing an emote
if
nil
and
false
then
"idle"
end
if
then
"idle"
false
end
""
nil
if
nil
then
disconnect
end
if
nil
then
Stop
Destroy
nil
end
for
in
pairs
do
if
then
Stop
Destroy
nil
end
end
return
end
function
getHeightScale
if
then
if
not
then
return
1
end
local
if
nil
then
script
FindFirstChild
"ScaleDampeningPercent"
end
if
nil
then
1
end
return
end
return
1
end
local
function
signedAngle
return
math
atan2
end
local
2.0
local
function
get2DWeight
local
0.5
local
signedAngle
local
signedAngle
local
local
local
math
clamp
1.0
0.0
1.0
return
end
local
function
blend2D
local
local
0.0
for
in
pairs
do
if
0.0
or
0
then
-- Require same quadrant as target
0.0
continue
end
math
for
in
pairs
do
if
0.0
or
0
then
-- Require same quadrant as target
continue
end
math
min
get2DWeight
end
end
--truncates below 10% contribution
local
0.0
local
0
local
0
for
in
pairs
do
if
0.1
then
else
0.0
end
end
local
local
if
then
math
sqrt
else
0
end
getHeightScale
local
0
for
in
pairs
do
if
then
break
end
end
for
in
pairs
do
-- if not loco
if
0.0
then
if
not
then
Play
end
local
math
max
AdjustWeight
AdjustSpeed
else
Stop
end
end
end
local
function
getWalkDirection
local
local
if
Vector3
then
return
elseif
or
Vector3
then
local
if
then
PointToWorldSpace
else
end
local
Vector3
if
then
Vector3
new
0.0
local
if
0.01
then
end
end
return
else
return
end
end
local
function
updateVelocity
local
if
then
local
getWalkDirection
if
not
then
return
end
local
if
math
abs
or
"Running"
or
0.001
then
-- We are horizontal! Do something (turn off locomotion)
for
in
pairs
do
if
then
AdjustWeight
end
end
return
end
local
local
Vector3
new
0.0
--sensible upVector means this is non-zero.
local
Dot
if
0.0
and
0.05
then
-- break quadrant ties in favor of forward-friendly strafes
end
local
local
Vector2
new
-- root space moveDirection
local
Vector2
new
-- Time check serves the purpose of the old keyframeReached sync check, as it syncs anim timePosition
if
Dot
0.001
or
math
abs
0.01
or
1
then
blend2D
end
else
if
math
abs
0.01
or
1
then
blend2D
Vector2
end
end
end
function
setAnimationSpeed
if
"walk"
then
if
then
AdjustSpeed
end
end
end
function
keyFrameReachedFunc
if
"End"
then
local
-- return to idle if finishing an emote
if
nil
and
false
then
"idle"
end
if
then
if
then
-- Allow the emote to loop
return
end
"idle"
false
end
local
playAnimation
0.15
setAnimationSpeed
end
end
function
rollAnimation
local
math
random
1
local
local
1
while
do
1
end
return
end
local
local
function
destroyRunAnimations
for
in
pairs
do
if
then
Stop
Destroy
nil
end
end
for
in
pairs
do
if
then
Stop
Destroy
nil
end
end
0
end
local
function
resetVelocityBounds
0
0
0
0
end
local
function
updateVelocityBounds
if
then
if
then
end
if
then
end
if
then
end
if
then
end
end
end
local
function
checkVelocityBounds
if
0
or
0
or
0
or
0
then
if
then
warn
"Strafe blending disabled. Not all quadrants of motion represented."
end
else
end
end
local
function
setupWalkAnimation
resetVelocityBounds
-- check to see if we need to blend a walk/run animation