I have this script in server script service that changes the walk speed of my zombie team. I want my zombie team to have its own idle and walk animations specific to that team. How can I do this? I want to make it so if the zombie isn't moving, it plays the idle animation. When the zombie moves, it plays the walk animation. Please help!
Here's the script: local Players = game:GetService("Players") local Team = game:GetService("Teams")["Zombie"]
local function onCharacterAdded(character) local plr = Players:GetPlayerFromCharacter(character)
if plr.Team == Team then character:WaitForChild("Humanoid").WalkSpeed = 11 end
end
local function onPlayerAdded(player)
if player.Character then onCharacterAdded(player.Character) end player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)
Check this out!
I recommend using Team.PlayerAdded
instead since it fires whenever a player is assigned to that team.
local Teams = game:GetService("Teams") local Team = Teams:WaitForChild("Zombie") Team.PlayerAdded:Connect(function(newTeammate) local character = newTeammate.Character or newTeammate.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local animator = humanoid:WaitForChild("Animator") humanoid.WalkSpeed = 11 for _, playingTrack in ipairs(animator:GetPlayingAnimationTracks()) do playingTrack:Stop(0) end local animateScript = character:WaitForChild("Animate") -- change [PUT ANIMATION ID HERE] to the animation id you want animateScript.run.RunAnim.AnimationId = "rbxassetid://[PUT ANIMATION ID HERE]" -- example is 656118852 which is the ninja run animateScript.walk.WalkAnim.AnimationId = "rbxassetid://[PUT ANIMATION ID HERE]" -- example is 619522849 which is the robot walk animateScript.idle.Animation1.AnimationId = "rbxassetid://[PUT ANIMATION ID HERE]" -- example is 10921155160 which is the ninja idle 1 animateScript.idle.Animation2.AnimationId = "rbxassetid://[PUT ANIMATION ID HERE]" -- example is 10921155867 which is ninja idle 2 end)
If this still doesn't work try creating your custom Animate script by following this guy!