Animation weirdly not loading

Try adding a game:GetService(¨RunService¨).Heartbeat:Wait(0.3) after each animation string.

Like this?

function animate()
	aimanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Parent.Animations.AimAnim)
	game:GetService("RunService").Heartbeat:Wait(0.3)
	patrolanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Parent.Animations.PatrolRestAnim)
	game:GetService("RunService").Heartbeat:Wait(0.3)
	fireanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Parent.Animations.FireAnimation)
end

Tried it, still not working. :frowning:

Mhm. This is so we can make sure that the animations are loading properly, while making sure its smooth. A regular wait string can get a bit messy and mess up how smooth your code functions.

I’m going to attempt to move around the LoadAnimations, to see if it has something to do with cooldowns. 1 moment.

Here, I think this article should do justice.

Alright. This should work as many people mention the overriding that could be happening. If the wait statements dont work, please try extending the length just to see if we have a fix to the issue. We can always mess with the wait length later.

I moved them around, still seems like the resting animation and aiming animation still work, even though resting LoadAnimation was replaced with where the fire animation was loaded. It seems like something is broken with fire animation. I can’t find anything though

Use a print statement and mess around with it more. If it still doesnt work only for that animation, you should figure out issues with that specific animation.

I’ve set the animation priorities as follow:

Aiming - Movement
Resting - Movement
Fire - Action

Seeing from another post, action overrides movement. I’m not sure what’s happening.

Alright, will try now to do that now.

All animations were successfully loaded, but fire still not playing!

image

Alright, so this means this issue is not with the script itself, but the animation itself. This could be from properties or something else. I need you to send a screenshot of animation properties and then make sure the animation URL is correct and do basic checks to make sure its all good.

image


local fireanimURL = ¨InsertAnimationUrlHere¨

fireanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(¨¨)

Use that and instead of using the current method, try to load the animation via the ROBLOX URL.

Do you want me to use the actual ROBLOX link, or the rbxassetid link?

Use the URL with this type of link, ¨"rbxassetid://00000". A web URL or asset URL will not work.

I tried, getting an Unable to cast value to Object error.

Send your code again please. Its most likely due to the game trying to access something before it loaded. More detail: Unable to cast value to Object error?

local aimanim
local patrolanim
local fireanim
local aimurl = 'rbxassetid://5827230227'
local fireurl = 'rbxassetid://5827260451'
local patrolurl = 'rbxassetid://5827116608'

function animate()
	aimanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(aimurl)
	fireanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(fireurl)
	patrolanim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(patrolurl)
end

tool.Equipped:Connect(function(mouse)
	animate()


The index nil error is when it stops the animations on unequip. Top one is when is the LoadAnimation.