This script sits in workspace, and changes the characters animations. I'm trying to make it so if your on Bright green team you get zombie animations, but if your not on green team you get regular Animations.
-There is much more script, but I could not fit it.
Here is my script:
[EDIT] - The normal animations work when your not on the Green team, however if you switch teams you don't get the zombie animations. [Btw these are my own custom animations]
function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)
if child then return child end
while true do
child = parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end
for i, v in pairs(game.Players:GetPlayers()) do
wait(0.005)
if v.TeamColor == BrickColor.new("Bright green") then
local Figure = script.Parent
local Torso = waitForChild(Figure, "Torso")
local RightShoulder = waitForChild(Torso, "Right Shoulder")
local LeftShoulder = waitForChild(Torso, "Left Shoulder")
local RightHip = waitForChild(Torso, "Right Hip")
local LeftHip = waitForChild(Torso, "Left Hip")
local Neck = waitForChild(Torso, "Neck")
local Humanoid = waitForChild(Figure, "Humanoid")
local pose = "Standing"
local currentAnim = ""
local currentAnimTrack = nil
local currentAnimKeyframeHandler = nil
local currentAnimSpeed = 1.0
local oldAnimTrack = nil
local animTable = {}
local animNames = {
idle = {
{ id = "rbxassetid://274830791", weight = 9 },
{ id = "rbxassetid://274830791", weight = 1 }
},
walk = {
{ id = "rbxassetid://274837028", weight = 10 }
},
run = {
{ id = "run.xml", weight = 10 }
},
jump = {
{ id = "rbxassetid://274809913", weight = 10 }
},
fall = {
{ id = "rbxassetid://274797468", weight = 10 }
},
climb = {
{ id = "rbxassetid://125750800", weight = 10 }
},
toolnone = {
{ id = "rbxassetid://125750867", weight = 10 }
},
toolslash = {
{ id = "rbxassetid://129967390", weight = 10 }
-- { id = "slash.xml", weight = 10 }
},
toollunge = {
{ id = "rbxassetid://129967478", weight = 10 }
},
wave = {
{ id = "rbxassetid://128777973", weight = 10 }
},
point = {
{ id = "rbxassetid://128853357", weight = 10 }
},
dance = {
{ id = "rbxassetid://130018893", weight = 10 },
{ id = "rbxassetid://132546839", weight = 10 },
{ id = "rbxassetid://132546884", weight = 10 }
},
laugh = {
{ id = "rbxassetid://129423131", weight = 10 }
},
cheer = {
{ id = "rbxassetid://=129423030", weight = 10 }
},
}
else
local Figure = script.Parent
local Torso = waitForChild(Figure, "Torso")
local RightShoulder = waitForChild(Torso, "Right Shoulder")
local LeftShoulder = waitForChild(Torso, "Left Shoulder")
local RightHip = waitForChild(Torso, "Right Hip")
local LeftHip = waitForChild(Torso, "Left Hip")
local Neck = waitForChild(Torso, "Neck")
local Humanoid = waitForChild(Figure, "Humanoid")
local pose = "Standing"
local currentAnim = ""
local currentAnimTrack = nil
local currentAnimKeyframeHandler = nil
local currentAnimSpeed = 1.0
local oldAnimTrack = nil
local animTable = {}
local animNames = {
idle = {
{ id = "rbxassetid://125750544", weight = 9 },
{ id = "rbxassetid://125750544", weight = 1 }
},
walk = {
{ id = "rbxassetid://125749145", weight = 10 }
},
run = {
{ id = "run.xml", weight = 10 }
},
jump = {
{ id = "rbxassetid://274809913", weight = 10 }
},
fall = {
{ id = "rbxassetid://274797468", weight = 10 }
},
climb = {
{ id = "rbxassetid://125750800", weight = 10 }
},
toolnone = {
{ id = "rbxassetid://125750867", weight = 10 }
},
toolslash = {
{ id = "rbxassetid://129967390", weight = 10 }
-- { id = "slash.xml", weight = 10 }
},
toollunge = {
{ id = "rbxassetid://129967478", weight = 10 }
},
wave = {
{ id = "rbxassetid://128777973", weight = 10 }
},
point = {
{ id = "rbxassetid://128853357", weight = 10 }
},
dance = {
{ id = "rbxassetid://130018893", weight = 10 },
{ id = "rbxassetid://132546839", weight = 10 },
{ id = "rbxassetid://132546884", weight = 10 }
},
laugh = {
{ id = "rbxassetid://129423131", weight = 10 }
},
cheer = {
{ id = "rbxassetid://=129423030", weight = 10 }
},
}
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
local emoteNames = { wave = false, point = false, dance = true, laugh = false, cheer = false}
math.randomseed(tick())
-- Setup animation objects
for name, fileList in pairs(animNames) do
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
-- check for config values
local config = script:FindFirstChild(name)
if (config ~= nil) then
-- print("Loading anims " .. name)
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
-- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
idx = idx + 1
end
end
