I started making a game and wanted to play an animation right after the players character is spawning in. I normally know what to do and how it works but everything I tried so far doesn’t seem to work and I have no more ideas left on how I could fix it. Any help is appreciated.
-- // Variables
-- # Services
local playersService = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
-- # Objects
local player = playersService.LocalPlayer
local character = player.Character
local assets = replicatedStorage.Assets
local animations = assets.Animations
local idleAnimation = animations.Idle
-- // Functions
function onCharacterAdded(character: Model)
local humanoid = character:FindFirstChild("Humanoid")
local animator = humanoid:FindFirstChild("Animator")
local track: AnimationTrack = animator:LoadAnimation(idleAnimation)
track:Play()
end
if character then
onCharacterAdded(character)
end
player.CharacterAdded:Connect(onCharacterAdded)
Just for clarification, the script is in “StarterPlayerScripts”, I set the animation priority to: “Action”, and I made sure the animation is looping since it only has one keyframe.
i have just tested your code, and there doesn’t seem to be any problems occuring. so maybe you’re stopping all animations in a different code?, OR the animation isn’t your’s or the animation was deleted and all that
That’s interesting, but I don’t really have much code in this place currently. I only have a module and server script which both only have something to do with leaderstats. The animation was also made by me I even remade it just to be sure but still there’s no animation showing up, I guess my place is cursed or something.
I tried using the other animation still nothing was shown. I know that It makes a track because I can print the track and it doesn’t give me some wrong value, so I guess I’m just cursed or Roblox wants to see my downfall for some reason.
i dont think it matters if the animation is uploaded to the group or not. if hes the owner of the animation it should work even if its not in the group