In my game, I want all players to use a custom R15 animation pack. To make this work, I’ve used a script on the DevHub.
However, it doesn’t work when joining the game.
In the console, it gives me this error:
This is my script:
local Players = game:GetService("Players")
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
playingTracks:Stop(0)
end
local animateScript = character:WaitForChild("Animate")
animateScript.run.RunAnim.AnimationId = "rbxassetid://782842708" -- Run
animateScript.walk.WalkAnim.AnimationId = "rbxassetid://782843345" -- Walk
animateScript.jump.JumpAnim.AnimationId = "rbxassetid://782847020" -- Jump
animateScript.idle.Animation1.AnimationId = "rbxassetid://782841498" -- Idle (Variation 1)
animateScript.idle.Animation2.AnimationId = "rbxassetid://782845736" -- Idle (Variation 2)
animateScript.fall.FallAnim.AnimationId = "rbxassetid://782846423" -- Fall
animateScript.swim.Swim.AnimationId = "rbxassetid://782844582" -- Swim (Active)
animateScript.swimidle.SwimIdle.AnimationId = "rbxassetid://782845186" -- Swim (Idle)
animateScript.climb.ClimbAnim.AnimationId = "rbxassetid://782843869" -- Climb
end
local function onPlayerAdded(player)
player.CharacterAppearanceLoaded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)
How should I make it work? I’m sorry if I am asking stupid questions. I am not that experienced with the Lua code language.