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

How can I change this script to make this team have its own character anims?

Hi. I have this "Zombie" team, and I have a script that changes its walk speed, but I also want to replace all of the default animations like walking and such. Can someone help me modify the script I already have?

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)

1 answer

That's Pretty Easy to do...

use this code inside ServerStorage:

local Players = game:GetService("Players")

local function onCharacterAdded(character)
	-- Get animator on humanoid
	local humanoid = character:WaitForChild("Humanoid")
	local animator = humanoid:WaitForChild("Animator")

	-- Stop all animation tracks
	for _, playingTrack in pairs(animator:GetPlayingAnimationTracks()) do
		playingTrack:Stop(0)
	end

	local animateScript = character:WaitForChild("Animate")
	--animateScript.run.RunAnim.AnimationId = "rbxassetid://"
	--animateScript.walk.WalkAnim.AnimationId = "rbxassetid://"
	--animateScript.jump.JumpAnim.AnimationId = "rbxassetid://"
	--animateScript.idle.Animation1.AnimationId = "rbxassetid://"
	--animateScript.idle.Animation2.AnimationId = "rbxassetid://"
	--animateScript.fall.FallAnim.AnimationId = "rbxassetid://"
	--animateScript.swim.Swim.AnimationId = "rbxassetid://"
	--animateScript.swimidle.SwimIdle.AnimationId = "rbxassetid://"
	--animateScript.climb.ClimbAnim.AnimationId = "rbxassetid://"
end

local function onPlayerAdded(player)
	player.CharacterAppearanceLoaded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)

note:replace the comments and put after the :// put the animation ID. Hope it works note: require the script inside yours (also call seververstorage) (and require it inside your team if stamment!

Hope it works!

2 comments

0

I don't know what you mean by "call serverstorage and require it inside your team if statement." You're saying I need to call serverstorage?

0

The script, not sever storage

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