Simply put, when I change the default animations, the shoulders, feet, and torso still move unlike the animation makes it to be.
Here’s a video to show how it looks:
More Context
I modified the Roblox character Animate script to change certain animations during gameplay. With it, I’m switch the default run and idle animations. Switching the idle animation works just fine, but when I switch the default running animation, it switches, but still moves certain parts of the character. Some of these parts are the shoulders, feet, and the torso. (as shown on the video)
Code
Here are the only parts I added to the Animate Script to make this work:
local updateAnimations = false
function configureAnimationSet(name, fileList)
if (animTable[name] ~= nil) then
for _, connection in pairs(animTable[name].connections) do
connection:disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
local allowCustomAnimations = true
local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end)
if not success then
allowCustomAnimations = true
end
-- check for config values
local config = script:FindFirstChild(name)
if (allowCustomAnimations and config ~= nil and not updateAnimations) 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))
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:WaitForChild('changeAnimation').OnInvoke = function(DataPack)
if typeof(DataPack) ~= 'table' then return end
if not DataPack.Name then return end
if typeof(DataPack.Name) ~= 'string' then return end
if typeof(DataPack.Animations) ~= 'table' then return end
if #DataPack.Animations == 0 then return end
updateAnimations = true
configureAnimationSet(DataPack.Name, DataPack.Animations)
print('For: ' .. DataPack.Name)
print(animTable[DataPack.Name])
return true
end
Does anyone have any idea why this happens? Is this a programming thing or is it an animation thing because I’ve looked pretty deep into the Animate code and tried other things like changing the values of the Animation Instances inside of the animate script as well, with no luck.
Any help would be greatly appreciated and thank you for your time!