#idle animation doesnt work

1 messages · Page 1 of 1 (latest)

torpid frost
#

print("yea here for some reason")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Model = ReplicatedStorage:WaitForChild("StandModel")

if Model then
print("model exists")
local function findHumanoid(model)
for _, child in pairs(model:GetDescendants()) do
if child:IsA("Model") and child:FindFirstChild("Humanoid") then
return child:FindFirstChild("Humanoid")
end
end
return nil
end

while true do
    for _, child in pairs(Model:GetChildren()) do
        print("Child Model:", child.Name)
        local Humanoid = findHumanoid(child)
        if Humanoid then
            print("found humanoid in child model")
            local Animator = Humanoid:FindFirstChild("Animator") or Instance.new("Animator", Humanoid)

            if Animator then
                print("animator instance", Animator)
                local Animation = Instance.new("Animation")
                Animation.AnimationId = "rbxassetid://103480708667499"

                local success, message = pcall(function()
                    Animator:PlayAnimation(Animation, "Idle")
                end)

                if not success then
                    warn("Failed to play animation: " .. message)
                end
            else
                warn("Failed to create Animator instance")
            end
        end
    end

    -- Wait 1 second before checking again
    wait(1)
end

else
warn("Failed to find Model")
end

#

this script is in server script services and there is ANOTHER script that when a player presses E a stand appear

#

the problem with this script is that it needs to play an animation when the stand appear

#

but it doesnt do that (btw the standmodel is in replicated storage and it get cloned into the workspace following the player when the player presses E)

random oracle
torpid frost