Replacing a player's default animations

Hello!

So is there a way to replace a players animations based off of a leaderstat?
(Walking, Jumping, etc.)

Thanks!

You can try this

game.Players.PlayerAdded:Connect(function(plr)
   plr.Character.Animate.walk.WalkAnim.AnimationId= your id here
end)

Is there a way to do it mid game? like not at the beginning of it?

Yes, but you’d have to get the player somehow

You use the character to change the anim, so getting the player from the character would be useless

Oh, alrighty!

Do you know what would work? If so, please explain. :DDD

I think he means connecting the animation change function via an event

For instance, if you’d want it to change when the player touches a part you’d do

part.Touched:Connect(function(p)
    if p.Parent and p.Parent:GetPlayerFromCharacter() then
        p.Parent.Animate.walk.WalkAnim.AnimationId = your id here
    end
end)
1 Like

Could I do,

local plr = game.Players.LocalPlayer.Name
local character = workspace[plr].Animate.walk.WalkAnim.AnimationId = your id here

it would be easier to simply do Player.Character, but yes!

local plr = game.Players.LocalPlayer
plr.Character.Animate.walk.WalkAnim.AnimationId = your id here

I did this,

local plr = game.Players.LocalPlayer.Name
plr.Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid://5604380139"
print("Done")

But nothing worked, is there a better way to find your player’s name?

remove .Name

-

It says, ‘Attept to index nil with character’

Use a local script and you also need to wait for the character to load in so,

local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
plr.Character.Animate.walk.WalkAnim.AnimationId = "rbxassetid://5604380139"
print("Done")

Sorry I keep forgetting to remove the .Name by accident

Will the animation only show for me? or for everyone else aswell?

I think the script replicates it automatically, but you’d have to test it

If not, you can switch to a server script and define the player differently

How can I do that? (Thank you so much for the help!)

1 Like

Depends on how you want to obtain the target player