Ok so I made a script that turns you into a zombie but I want to fire a event that changes the players animations but it isn’t working (no errors)
script: Server
local event = game:GetService("ReplicatedStorage").ZombieAnimation
local zombieAnimations = game.ReplicatedStorage.ClonedValues["Zombie Animation"].Animate:Clone()
event.OnServerEvent:Connect(function(player)
game.Players.PlayerAdded:Connect(function(player)
game.Players.CharacterAdded:Connect(function(character)
local human = character:WaitForChild("Humanoid");
human.Parent.Animate:Destroy()
zombieAnimations.Parent = human.Parent
print("Replaced Animations")
end)
end)
end)
localscript: Client
local players = game:GetService("Players")
local event = game:GetService("ReplicatedStorage").ZombieAnimation
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local human = character:WaitForChild("Humanoid")
player:GetPropertyChangedSignal("Team"):Connect(function()
human.Died:Connect(function(deadPlayer)
if player.Team == game.Teams.Zombie then
if player.Name == "Remingling" then
player.Team = game.Teams.ewner
else
player.Team = game.Teams.normie
end
end
end)
if player.Team == game.Teams.Zombie then
human.Health = 100
local temphand = human.Parent:findFirstChild("Body Colors")
local temphead = human.Parent:FindFirstChild("Head")
local zombieAnimations = game:GetService("ReplicatedStorage").ClonedValues["Zombie Animation"].Animate:Clone()
event:FireServer()
temphead:FindFirstChild("face").Texture = "http://www.roblox.com/asset/?id=134724710"
temphand.LeftArmColor = BrickColor.new("Artichoke")
temphand.RightArmColor = BrickColor.new("Artichoke")
temphand.HeadColor = BrickColor.new("Artichoke")
if human.Parent:findFirstChild("UpperTorso") then
if human.Parent:findFirstChild("UpperTorso"):FindFirstChild(script.Name)==nil then
local thisone = script
local thisoneclone = thisone:Clone()
thisoneclone.Parent = human.Parent:FindFirstChild("UpperTorso")end
elseif human.Parent:FindFirstChild("HumanoidRootPart") then
if human.Parent:FindFirstChild("HumanoidRootPart"):FindFirstChild(script.Name)==nil then
local thisone = script
local thisoneclone = thisone:Clone()
thisoneclone.Parent = human.Parent:FindFirstChild("HumanoidRootPart")end
elseif human.Parent:FindFirstChild("LowerTorso") then
if human.Parent:FindFirstChild("LowerTorso"):FindFirstChild(script.Name)==nil then
local thisone = script
local thisoneclone = thisone:Clone()
thisoneclone.Parent = human.Parent:FindFirstChild("LowerTorso")end
elseif human.Parent:FindFirstChild("Torso") then
if human.Parent:FindFirstChild("Torso"):FindFirstChild(script.Name)==nil then
local thisone = script
local thisoneclone = thisone:Clone()
thisoneclone.Parent = human.Parent:FindFirstChild("Torso")
end
end
end
end)
end)
end)