#animation failed to load

17 messages · Page 1 of 1 (latest)

molten monolith
#

kk

#

local function playAnimation()
local character = game.Players.LocalPlayer.Character
local humanoid = character and character:FindFirstChild("Humanoid")

if humanoid then
    local animator = humanoid:FindFirstChildOfClass("Animator")

    if animator then
        local animation = script.Animation

        animator:LoadAnimation(animation):Play()
    end
end

end

local function onKeyPress(input)
if input.KeyCode == Enum.KeyCode.E then
playAnimation()
end
end

game:GetService("UserInputService").InputBegan:Connect(onKeyPress)

its a local script inside the starterplayerscripts

#

@ocean osprey

tired ingot
#

💀

tired ingot
molten monolith
#

so how to fix it?

tired ingot
#

you are trying to index a nil value because the local script runs way too fast and the character does not have the chance to load itself

#

replace that ^ with local Character = game.Players.LocalPlayer.CharacterAdded:Wait()

molten monolith
#

dude

#

rn the animation is not even playing

#

i dont see the error

#

what is wrong rn?

tired ingot
#

change this

#

to

#

local humanoid = character:WaitForChild('Humanoid')

molten monolith
#

still not working