If you are confused, let me explain. I was trying to overwrite the default walk animations to my own walk animation which I have here: Pillow fight run - Roblox
The animation here has an asset id and can be previewed just fine but when I use the API reference script to overwrite it here:
local Players = game:GetService("Players")
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
playingTracks:Stop()
end
local animateScript = character:WaitForChild("Animate")
animateScript.run.RunAnim.AnimationId = "rbxassetid://7124613658" -- Run (My animation)
animateScript.walk.WalkAnim.AnimationId = "rbxassetid://616168032" -- Walk
animateScript.jump.JumpAnim.AnimationId = "rbxassetid://616161997" -- Jump
animateScript.idle.Animation1.AnimationId = "rbxassetid://616158929" -- Idle (Variation 1)
animateScript.idle.Animation2.AnimationId = "rbxassetid://616160636" -- Idle (Variation 2)
animateScript.fall.FallAnim.AnimationId = "rbxassetid://616157476" -- Fall
animateScript.climb.ClimbAnim.AnimationId = "rbxassetid://616156119" -- Climb
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)
I noticed that most of the code is deprecated and cannot be used. I can’t find an alternative and have tried to update it to this:
local Players = game:GetService("Players")
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
for _, playingTracks in pairs(humanoid.Animator:GetPlayingAnimationTracks()) do -- First change
playingTracks:Stop()
end
local animateScript = character:WaitForChild("Animate")
animateScript.run.RunAnim.AnimationId = "rbxassetid://7124613658" -- Run (My animation)
animateScript.walk.WalkAnim.AnimationId = "rbxassetid://616168032" -- Walk
animateScript.jump.JumpAnim.AnimationId = "rbxassetid://616161997" -- Jump
animateScript.idle.Animation1.AnimationId = "rbxassetid://616158929" -- Idle (Variation 1)
animateScript.idle.Animation2.AnimationId = "rbxassetid://616160636" -- Idle (Variation 2)
animateScript.fall.FallAnim.AnimationId = "rbxassetid://616157476" -- Fall
animateScript.climb.ClimbAnim.AnimationId = "rbxassetid://616156119" -- Climb
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded) -- Second change
end
Players.PlayerAdded:Connect(onPlayerAdded)
But still get this result:
If there are any fixes or alternatives to this, I would really appreciate them.