How to change a player's animations if they have a certain username

Hello! I’ve recently came to a dilemma; I would like to change animations for the player exclusively by username registering (in this instance, my username), however although it does change the actual animation track’s ID, it does not play the new animation. In this case, it is the player’s idle animation.

Here’s a test script I’m currently using:

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://8085184993"
	animateScript.idle.Animation2.AnimationId = "rbxassetid://8085184993"
end
 
local function onPlayerAdded(player)
	if player.Character then
		if player.Name == "Exphxoria" then
			onCharacterAdded(player.Character)
		end
	end
	player.CharacterAdded:Connect(onCharacterAdded)
end
 
Players.PlayerAdded:Connect(onPlayerAdded)

If you have any solutions, let me know! So far nothing else I’ve seen has been able to work properly.

1 Like

loop through the players if the player name is well “Exphxproa” then yea play the anim (sorry for not giving the code i am kinda busy)

That’s not necessarily the part I’m having trouble with, it’s replaying the actual animation that is the issue (aka the animation ID changes but it doesn’t actually play whilst idle).

use Anim:Stop() then IGNORE

That’s what I did. Still doesn’t work correctly.

try

if not player:HasAppearanceLoaded ( )then
player.CharacterAppearanceLoaded:Wait()
end
1 Like

Or alternatively.

player.CharacterAppearanceLoaded:Connect(onCharacterAdded)
1 Like

Once again, it isn’t an issue with the ID actually changing and waiting for the character. The ID does change but it does not play on the character, even once they have spawned and the script has waited before executing the code.

1 Like

Find the Animate script within the Character after playing, copy it, and then paste it into ReplicatedStorage. When the character is added, delete their current one and clone that one into their character.

Edit: Don’t forget to go into the new one and change the ID’s to the ones you want.

1 Like