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

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

Asked by 1 year ago
Edited 1 year ago

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

Log in to vote
0
Answered by 1 year ago

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!

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? LunaticFETCH 5 — 1y
0
The script, not sever storage Hgamerpro50 0 — 1y
Ad

Answer this question