I’m currently trying to play an animation when the client receives an event signal after reaching an objective. Simply put, the animation doesn’t play.
Here is my relevant code:
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local humRoot = char:WaitForChild("HumanoidRootPart")
local hum = char:WaitForChild("Humanoid")
-- Animations
local ffAnimID = "rbxassetid://11525420159"
local animator = hum:WaitForChild("Animator")
local ffAnim = Instance.new("Animation")
ffAnim.AnimationId = ffAnimID
local ffAnimTrack = animator:LoadAnimation(ffAnim)
ffAnimTrack.Looped = true
ffAnimTrack.Priority = Enum.AnimationPriority.Action
local function animPlay()
ffAnimTrack:Play()
end
animPlay()
There are no errors in the output.
I have looked through other devforum posts similar and I can’t seem to find a solution. I own this animation. The script is placed in StarterPlayerScripts, but I’ve also tried StartCharacterScripts before. I’ve also tried changing the animation priority and loading the animation through the humanoid.
In case it’s relevant, in the same script I have a function that uses ContextActionService to bind actions at a higher priority than the base movement keys, disabling movement entirely. However, I’ve tried removing the binds and nothing seems to change so I doubt that this is the cause.
That doesn’t seem to solve the problem, but possibly a future one. I’ve added that fix in anyways for when the animation actually does work, but as of now, the problem persists.
I’ve remade the script so you can see if it helps. Yet, I do not believe it is the script itself that is the issue, but the animation.
Here:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local rootpart = character:WaitForChild("HumanoidRootPart")
function PlayAnimation(animator, id)
local Template = Instance.new("Animation")
Template.AnimationId = "rbxassetid://" .. id
return animation animator:LoadAnimation(Template)
end
PlayAnimation(humanoid.Animator, 11525420159)
If the issue pursues, make sure it isn’t the animation asset itself that is having issues, and you may set Looped and Priority properties inside the animation editor before publishing, these will take effect when loading the animation later on with a script.
I tested this and it also doesn’t work, however, I have realized the problem (And I feel pretty dumb for not realizing it)
This is a team create session, and another member changed the game setting to only allow R15 users. The animation is R6. Welp, at least I know now. Thanks for all the help
Another member of the group changed the game settings to R15 users only, the animation is R6. So be sure to communicate with your team members, and maybe not be as stupid as me.