I can’t post a engine bug, so I need your help to post it for me.
though I am not entirely sure this is an engine bug, storing a animationtrack inside a objectvalue disappears after 1 second.
Here is an example of my code:
task.spawn(function()
-- task.wait()
for _, folder in pairs(animationfolder:GetChildren()) do
local newFolder = Instance.new('Folder', data.animations)
newFolder.Name = folder.Name
-- data.animations[folder.Name] = {}
local recursive
local paths = {}
recursive = function(path, folder)
-- task.wait()
hum:WaitForChild("Animator")
for _, anim in pairs(folder:GetChildren()) do
if anim:IsA("Animation") then
-- local track = hum:WaitForChild("Animator"):LoadAnimation(anim)
-- path[anim.Name] = track
pcall(function()
local objvalue = Instance.new("ObjectValue", path)
objvalue.Name = anim.Name
objvalue.Value = hum.Animator:LoadAnimation(anim)
task.delay(1, function()
print(objvalue.Value) -- prints true sometimes, then sometimes not
end)
end)
elseif anim:IsA('Folder') then
local newpath = Instance.new("Folder", path)
newpath.Name = anim.Name
recursive(newpath, anim)
-- path[anim.Name] = {}
-- recursive(path[anim.Name], anim)
end
end
end
recursive(data.animations[folder.Name], folder)
end
--[[
for _, folder in pairs(animationfolder:GetChildren()) do
data.animations[folder.Name] = {}
for _, anim in pairs(folder:GetChildren()) do
if anim:IsA("Animation") then
local track = hum:LoadAnimation(anim)
data.animations[folder.Name][anim.Name] = track
end
end
end
]]
end)
i believe this is a bug because they are magically disappearing, like this 2015 post which has not been looked upon i believe; ObjectValue's reference to an AnimationTrack magically disappears? - #2 by GigsD4X
this is quite frustrating, hindering my workflow. Also this code is being ran on the server everytime the player respawns.
To summarize, after setting the objectvalue’s value to the animation track, it disappears after few miliseconds, though you can do objectvalue.Value:Play() within that time.