As I was working on a ragdoll script that included animations I noticed this bug that I also noticed when I was making a custom version of Animate.
Characters that don’t have an actively playing animation will bug out and cause the limbs to be randomly scattered, I do not know what causes this all I know is it stops happening when I turn off the Adaptive Animations beta Feature.
With adaptive animations enabled:
Without adaptive animations enabled:
I don’t think it’s a performance issue but regardless
Incase its nessicairy, my System information:
CPU: Intel(R) Core™ i5-10400 CPU @ 2.90GHz
GPU: NVIDIA GeForce GTX 1660 SUPER
I am not sure what makes this happen but if I had to guess I think it has something to do with the animation not having a fallback, so if theres no animation to be played it won’t just lock the parts on the default places rather it gets stuck on where the last frame ended. (This is just a theory)
No fallback animation with adaptive animations on:
No fallback animation with adaptive animations off:
Edit: (I forgot to comment out certain parts dependant on other scripts)
Here’s the animate script that im using which I made myself:
local Players = game:GetService("Players")
local Debris = game:GetService("Debris")
local TweenService = game:GetService("TweenService")
local Replicated = game:GetService("ReplicatedStorage")
--local Storage = Replicated:WaitForChild("Storage")
--local Modules = Storage:WaitForChild("Modules")
--local BridgeNet = require(Modules:WaitForChild("BridgeNet"))
--local Effects = BridgeNet.CreateBridge("Effects")
local PlayerScripts = Players.LocalPlayer:WaitForChild("PlayerScripts")
--local PlrConfig = require(PlayerScripts:WaitForChild("PlayerConfig"):WaitForChild("ConfigModule"))
local character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait()
local Humanoid = character:WaitForChild("Humanoid")
local rootPart = character:WaitForChild("HumanoidRootPart")
local state = "Standing"
local defaultAnimateScript = character:WaitForChild("Animate", 3)
local DefaultWalkSound = rootPart:WaitForChild("Running")
local DefaultJumpSound = rootPart:WaitForChild("Jumping")
local DefaultFallSound = rootPart:WaitForChild("Landing")
local DefaultDeathSound = rootPart:WaitForChild("Died")
if defaultAnimateScript then
defaultAnimateScript:Destroy()
DefaultWalkSound:Destroy()
DefaultJumpSound:Destroy()
DefaultFallSound:Destroy()
DefaultDeathSound:Destroy()
end
local stepDebounce = false
local loadedAnims = {}
local animDefinitions = {
Idle = {
{ id = "rbxassetid://", weight = 10, markerConnections = {
}}
},
Walk = {
{ id = "rbxassetid://", weight = 10, markerConnections = {
--[[
Step = function(side)
if stepDebounce then return end
stepDebounce = true
Effects:Fire("Footprint", { Character = character, Side = side })
task.delay(0.1, function()
stepDebounce = false
end)
end,]]
}}
},
Sprint = {
{ id = "rbxassetid://", weight = 10, markerConnections = {
--[[
Step = function(side)
Effects:Fire(
"Footprint",
{
Character = character,
Side = side
}
)
end,]]
}}
},
Crawl = {
{ id = "rbxassetid://", weight = 10, markerConnections = {
}}
},
CrouchIdle = {
{ id = "rbxassetid://", weight = 10, markerConnections = {
}}
},
CrouchWalk = {
{ id = "rbxassetid://", weight = 10, markerConnections = {
}}
},
Jump = {
{ id = "rbxassetid://", weight = 10, markerConnections = {
}}
},
Fall = {
{ id = "rbxassetid://", weight = 10, markerConnections = {
}}
},
Land = {
{ id = "rbxassetid://", weight = 10, markerConnections = {
}}
},
Climb = {
{ id = "rbxassetid://180436334", weight = 10, markerConnections = {
}}
},
Sit = {
{ id = "rbxassetid://178130996", weight = 10, markerConnections = {
}}
},
Swim = {
{ id = "rbxassetid://", weight = 10, markerConnections = {
}}
},
SwimIdle = {
{ id = "rbxassetid://", weight = 10, markerConnections = {
}}
},
}
local Config = {
defAnimSpeed = 1,
SpeedScaling = 9.5,
SprintSpeedScaling = 17,
animTransitionTime = 0.2,
jumpAnimDuration = 0.3,
toolTransitionTime = 0.1,
fallTransitionTime = 0.3,
jumpMaxLimbVelocity = 0.75,
allowPrinting = false,
}
local currAnimName = ""
local currAnimTrack = nil
local currAnimInstance = nil
local currAnimSpeed = 1.0
local currAnimTimePosition = 0
local currAnimKeyframeConnections = {}
local lastAnimName = ""
local lastAnimInstance = nil
local lastAnimSpeed = 1.0
local lastAnimTimePosition = 0
local LockJump = false
local fallTickDuration = 0
local fallBeginPos = Vector3.new(0, 0, 0)
local jumpAnimTime = 0
local function isTableEmpty(tbl: {[any]: any}): boolean
return next(tbl) == nil
end
local function getRandAnimation(animName)
local roll = math.random(1, loadedAnims[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > loadedAnims[animName][idx].weight) do
roll = roll - loadedAnims[animName][idx].weight
idx = idx + 1
end
if Config.allowPrinting == true then
print(animName .. " " .. idx .. " [" .. origRoll .. "]")
end
local anim = loadedAnims[animName][idx].animInstance
return anim, idx
end
function setupAnimation(animName, animProperties)
if (loadedAnims[animName] ~= nil) then
for _, v in pairs(loadedAnims[animName].connections) do
v:Disconnect()
end
end
loadedAnims[animName] = {}
loadedAnims[animName].loadCount = 0
loadedAnims[animName].totalWeight = 0
if (loadedAnims[animName].loadCount <= 0) then
for propName, propValue in pairs(animProperties) do
loadedAnims[animName][propName] = {}
loadedAnims[animName][propName].animInstance = Instance.new("Animation")
loadedAnims[animName][propName].animInstance.Name = animName
loadedAnims[animName][propName].animInstance.AnimationId = propValue.id
loadedAnims[animName][propName].weight = propValue.weight
loadedAnims[animName].loadCount = loadedAnims[animName].loadCount + 1
loadedAnims[animName].totalWeight = loadedAnims[animName].totalWeight + propValue.weight
loadedAnims[animName][propName].connections = {}
if isTableEmpty(animProperties[propName].markerConnections) == false then
loadedAnims[animName][propName].connections = animProperties[propName].markerConnections
if Config.allowPrinting == true then
print(loadedAnims[animName][propName].connections)
end
end
end
end
end
for index, value in pairs(animDefinitions) do
--index = animName
--value = the table inside the animName
setupAnimation(index, value)
end
local animator = Humanoid:FindFirstChildOfClass("Animator")
if animator then
for _, track in ipairs(animator:GetPlayingAnimationTracks()) do
track:Stop()
track:Destroy()
end
end
function playAnimation(animName, transitionTime, animator)
if currAnimTrack == animName then
return
end
transitionTime = transitionTime or Config.AnimTransitionTime
if lastAnimName == animName then
else
local animInstance, idx = getRandAnimation(animName)
if (animInstance ~= currAnimInstance) then
if (currAnimTrack ~= nil) then
currAnimTrack:Stop(transitionTime)
currAnimTrack:Destroy()
currAnimTrack = nil
end
currAnimTrack = animator:LoadAnimation(animInstance)
currAnimTrack.Priority = Enum.AnimationPriority.Core
currAnimTrack:Play(transitionTime)
currAnimName = animName
currAnimInstance = animInstance
currAnimSpeed = -1
lastAnimName = animName
lastAnimInstance = animInstance
if (#currAnimKeyframeConnections > 0) then
for i, v in pairs(currAnimKeyframeConnections) do
v:Disconnect()
table.remove(currAnimKeyframeConnections, i)
end
end
if isTableEmpty(loadedAnims[animName][idx].connections) == false then
for i, v in pairs(loadedAnims[animName][idx].connections) do
table.insert(currAnimKeyframeConnections, currAnimTrack:GetMarkerReachedSignal(i):Connect(v))
end
end
end
end
end
function stopAllAnimations(transitionTime)
lastAnimName = currAnimName
lastAnimInstance = currAnimInstance
transitionTime = transitionTime or 0
currAnimName = ""
currAnimInstance = nil
if (#currAnimKeyframeConnections > 0) then
for _, v in pairs(currAnimKeyframeConnections) do
v:Disconnect()
end
end
if (currAnimTrack ~= nil) then
currAnimTrack:Stop(transitionTime)
currAnimTrack:Destroy()
currAnimTrack = nil
end
return lastAnimName, lastAnimInstance
end
function setAnimationSpeed(speed)
if speed == currAnimSpeed then
return
end
if character:GetAttribute("FreezeAnims") == true then
currAnimSpeed = 0
if currAnimTrack then currAnimTrack:AdjustSpeed(0) end
else
currAnimSpeed = speed
if currAnimTrack then currAnimTrack:AdjustSpeed(currAnimSpeed) end
end
end
local moveSpeed = 0
function onRunning(speed)
moveSpeed = speed
if speed > 3 and speed < 14 and character:GetAttribute("Sprinting") == nil then
playAnimation("Walk", 0.3, animator)
--setAnimationSpeed(Config.defAnimSpeed)
moveSpeed = speed
State = "Walking"
elseif speed < 3 then
playAnimation("Idle", 0.3, animator)
--setAnimationSpeed(Config.defAnimSpeed)
State = "Standing"
end
end
function onDied()
State = "Dead"
end
function onJumping()
playAnimation("Jump", 0.45, animator)
--setAnimationSpeed(Config.defAnimSpeed)
jumpAnimTime = Config.jumpAnimDuration
State = "Jumping"
end
function onClimbing(speed)
playAnimation("Climb", 0.1, animator)
setAnimationSpeed(speed / 12.0)
State = "Climbing"
end
function onGettingUp()
State = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("Fall", Config.fallTransitionTime, animator)
-- setAnimationSpeed(Config.defAnimSpeed)
end
State = "FreeFall"
end
function onFallingDown()
State = "FallingDown"
end
function onSeated()
State = "Seated"
end
function onPlatformStanding()
State = "PlatformStanding"
end
function onSwimming(speed)
if speed > 1.00 then
local scale = 5
playAnimation("Swim", 0.4, animator)
-- setAnimationSpeed(speed / scale)
State = "Swimming"
else
playAnimation("SwimIdle", 0.4, animator)
-- setAnimationSpeed(Config.defAnimSpeed)
State = "SwimIdle"
end
end
function onLanded(TravelDistance: number, FallTime: number)
FallTick = 0
if Config.allowPrinting == true then
print(TravelDistance)
print(FallTime)
end
if TravelDistance > 15 then
playAnimation("Land", 0, animator)
-- setAnimationSpeed(Config.defAnimSpeed)
LockJump = true
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
task.delay(0.5, function()
Humanoid.WalkSpeed = 11
Humanoid.JumpPower = 45
LockJump = false
State = "Standing"
end)
end
end
local lastTick = 0
function move(time)
local amplitude = 1
local frequency = 1
local deltaTime = time - lastTick
lastTick = time
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (State == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("Fall", Config.fallTransitionTime, animator)
setAnimationSpeed(Config.defAnimSpeed)
elseif (State == "Landed") or LockJump == true then
playAnimation("Land", Config.animTransitionTime, animator)
setAnimationSpeed(Config.defAnimSpeed)
elseif (State == "Seated") then
playAnimation("Fall", 0.5, animator)
setAnimationSpeed(Config.defAnimSpeed)
return
elseif character:GetAttribute("Sprinting") ~= nil and Humanoid:GetState() ~= Enum.HumanoidStateType.Jumping and Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall then
State = "Sprinting"
playAnimation("Sprint", 0.3, animator)
local forward = Humanoid.RootPart and Humanoid.MoveDirection:Dot(Humanoid.RootPart.CFrame.LookVector) > -0.1
currAnimSpeed = -1
local unit = forward and 1 or -1
setAnimationSpeed((moveSpeed / Config.SprintSpeedScaling) * unit)
elseif (State == "Walking") then
playAnimation("Walk", 0.1, animator)
local forward = Humanoid.RootPart and Humanoid.MoveDirection:Dot(Humanoid.RootPart.CFrame.LookVector) > -0.1
local unit = forward and 1 or -1
currAnimSpeed = -1
setAnimationSpeed((moveSpeed / Config.SpeedScaling) * unit)
elseif (State == "Dead" or State == "GettingUp" or State == "FallingDown" or State == "Seated" or State == "PlatformStanding") then
if Config.allowPrinting == true then
print("Wha " .. State)
end
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
elseif (State == "Standing") then
playAnimation("Idle", 0.3, animator)
setAnimationSpeed(Config.defAnimSpeed)
elseif (State == "SwimIdle") then
playAnimation("SwimIdle", 0.4, animator)
setAnimationSpeed(Config.defAnimSpeed)
end
end
Humanoid.Swimming:Connect(onSwimming)
Humanoid.Running:Connect(onRunning)
Humanoid.Climbing:Connect(onClimbing)
Humanoid.StateChanged:Connect(function(old: Enum.HumanoidStateType, new: Enum.HumanoidStateType)
if Config.allowPrinting == true then
print(new)
end
if new == Enum.HumanoidStateType.FallingDown then
onFallingDown()
end
if new == Enum.HumanoidStateType.Ragdoll then
if Config.allowPrinting == true then
print("Ragdoll")
end
end
if new == Enum.HumanoidStateType.GettingUp then
onGettingUp()
end
if new == Enum.HumanoidStateType.Jumping then
onJumping()
end
if new == Enum.HumanoidStateType.Freefall then
fallBeginPos = Vector3.new(rootPart.CFrame.X, rootPart.CFrame.Y, rootPart.CFrame.Z)
FallTick = tick()
onFreeFall()
end
if new == Enum.HumanoidStateType.Landed then
local LandPos = Vector3.new(rootPart.CFrame.X, rootPart.CFrame.Y, rootPart.CFrame.Z)
onLanded((LandPos - fallBeginPos).Magnitude, (tick() - FallTick))
State = "Landing"
end
if new == Enum.HumanoidStateType.Seated then
onSeated()
end
if new == Enum.HumanoidStateType.PlatformStanding then
onPlatformStanding()
end
if new == Enum.HumanoidStateType.Dead then
onDied()
end
end)
playAnimation("Idle", 0.1, animator)
setAnimationSpeed(Config.defAnimSpeed)
State = "Standing"
game:GetService("RunService").RenderStepped:Connect(move)
A rig with the animations I use in my script: Animations.rbxm (233.6 KB)