Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I change player's default animations?

I made a localScript witch is in StarterCharacterScripts, it contains the following code:

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.idle.Animation1.AnimationId = "rbxassetid://5432167890"

    animateScript.walk.WalkAnim.AnimationId = "rbxassetid://1759277502"

    animateScript.jump.JumpAnim.AnimationId = "rbxassetid://1760393958"

    animateScript.fall.FallAnim.AnimationId = "rbxassetid://1760423961"
end

local function onPlayerAdded(player)
    if player.Character then
        onCharacterAdded(player.Character)
    end
    player.CharacterAdded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)

It doesn't work, so anyone who could help me?

1 comment

0

why do you check for players being added inside the local script?

1 answer

✓ Accepted answer

You don't need to check for players being added within the player, all you need to do is have the stuff you had in the functions, but just leave them out of the functions. Since you said this was a local script, I'm assuming you placed it in character scripts.

wait()
local animateScript = script.Parent.Animate

animateScript.idle.Animation1.AnimationId = "rbxassetid://5432167890"

animateScript.walk.WalkAnim.AnimationId = "rbxassetid://1759277502"

animateScript.jump.JumpAnim.AnimationId = "rbxassetid://1760393958"

animateScript.fall.FallAnim.AnimationId = "rbxassetid://1760423961"

2 comments

0

Ok I'll try tomorrow, thanks for answering bye the way

0

It worked, thanks!!

This discussion is preserved as it was. New answers, comments, and votes are closed.