Why isn’t my animation playing? I’ve changed the priority and even do ‘hum.Animation:LoadAnimation()’. Any answers would be greatly appreciated, thanks!
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:WaitForChild('Humanoid')
local mouse = plr:GetMouse()
local animTrack = hum.Animator:LoadAnimation(script.Animation)
animTrack.Priority = Enum.AnimationPriority.Action
print(animTrack.Priority)
local curr = 1
mouse.Button1Down:Connect(function()
animTrack:Play()
print('anim played')
end)
Hey! I changed hum.Animator:LoadAnimation() to hum:LoadAnimation() and checked if the animation ID is empty(it isn’t), and yet it still doesn’t work. Hopefully I quick skim of my code gives you an idea.
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:WaitForChild('Humanoid')
local mouse = plr:GetMouse()
local animTrack = hum:LoadAnimation(script.Animation)
animTrack.Priority = Enum.AnimationPriority.Action
print(animTrack.Priority)
mouse.Button1Down:Connect(function()
animTrack:Play()
print('anim played')
end)
So this is an issue of either the id itself, if the game is a group game, then the animation must be uploaded to the group. If someone else owns the game, then it must be uploaded under their profile. If you own the game, you need to keep it under your ownership.
And,
local char = plr.CharacterAdded:Wait()
to
local char = plr.Character or plr.CharacterAdded:Wait()
Since animation code variates ill give you a piece of my code that you can implement in yours as a reference or to define something (sample code) since i don’t have a lot of time at the moment.
local ShotgunAnimIdle = Instance.new("Animation")
ShotgunAnimIdle.AnimationId = "rbxassetid://10004688896"
local AnimationTrackShotgunIdle = Humanoid.Animator:LoadAnimation(ShotgunAnimIdle)
AnimationTrackShotgunIdle.Priority = 3
Humanoid.Running:Connect(function(speed)
if speed > 0 then
-- when moving
else
-- other part of stuff here
end
end)