local replicatedStorage = game:GetService("ReplicatedStorage")
local contentProvider = game:GetService("ContentProvider")
local animationsFolder = replicatedStorage.Animations
function Init(player: Player)
for _, animation in pairs(animationsFolder:GetChildren()) do
local success, response = pcall(function()
contentProvider:PreloadAsync(animation)
end)
if success then
return
else
local character = player.Character or player.CharacterAdded:Wait()
local humanoid: Humanoid = player:WaitForChild("Humanoid")
local animator: Animator = humanoid:WaitForChild("Animator")
animator:LoadAnimation(animation)
end
end
end
return Init()
Why would you post this twice? Try deleting one.
Sorry i thought i deleted the last one and i made a new one because i put the wrong category and didnt send the code as code in the last one
1 Like
- Why are you returning when success? This would mean you can only successfully load one animation.
- I think you meant to type
character:WaitForChild("Humanoid")
instead ofplayer:WaitForChild("Humanoid")
. - Why are you returning
Init()
which isnil
?
Have you ran the script to see if it works?