Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I change player's default animations?

Asked by 5 years ago

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?

0
why do you check for players being added inside the local script? SteamG00B 1633 — 5y

1 answer

Log in to vote
0
Answered by
SteamG00B 1633 Moderation Voter
5 years ago
Edited 5 years ago

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"
0
Ok I'll try tomorrow, thanks for answering bye the way FrikiGameplaysHD 1 — 5y
0
It worked, thanks!! FrikiGameplaysHD 1 — 5y
Ad

Answer this question