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.
local aimanim = Instance.new(¨Animation¨)
aimanim.AnimationId = ¨rbxassetid://5827230227¨
local fireanim= Instance.new(¨Animation¨)
fireanim.AnimationId = rbxassetid://5827260451¨
local patrolanim = Instance.new(¨Animation¨)
patrolanim.AnimationId = ¨rbxassetid://5827116608¨
function animate()
aimanimTrack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(aimanim)
fireanimTrack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(fireanim)
patrolanimTrack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(patrolanim)
end
tool.Equipped:Connect(function(mouse)
animate()
Use this code please.
aimanim is defined as Instance.new('Animation')
… Do you want me to change the :LoadAnimation()
to the animation instance?
Oops, I’m silly. Nevermind what I said.
I did it, still same trouble with the fire animation. I’m gonna try to look through the animation a bit more.
Alr, what exactly is the issue you are having right now?
The original one, fire animation simply not playing. No errors.
Are you playing the track? You must play the track for it to execute.
Yes, see embedded code below.
fireanimTrack:Play()
script.Parent.Parent.Remotes.Shoot:FireServer(cursor.Hit.Position)
fireanimTrack:Stop()
I switched the clicking event from Button1Down to tool.Activated, still no success.
Can you ensure that your animation is set to the Action Priority?
The aiming and resting animation are set to Movement. The fire animation is set to Action.
I just fully remade the animation, and its still not working. I’m baffled to why this isn’t working.
Try keeping the SAME EXACT properties as the other animations and see what happens. If the animation works, then we know your issue is from properties.
I don’t think it’s the LoadAnimation that’s causing the trouble, and now that we’ve expanded the way the script loads the animations, it’s made it more difficult to set it’s parent before the tool is even equipped. I’m gonna go back to how I was normally loading the animations. I’m going to switch the fire animation to a reload animation that has the same animation priority, and see if it changes.
Mhm, after all the edits to the script it is clearly a issue with the animation. Whether its properties or the literal animation itself.