print("The Undead Coming Leaderboard script version 1.0 loaded") -- Jaredvaldez4 2011
undead = game.Workspace.Zombies
stage = game.Workspace.Stage
weapons = game.Workspace.Weapons
playing = game.Workspace.Playing
humans = game.Teams["Humans"]
zombies = game.Teams["Zombies"]
shared["Zombs"] = {};
shared["Weps"] = {};
shared["Weps"]["Pistol"] = weapons.Pistol:Clone();
weapons.Pistol:remove();
--[[for i, v in ipairs(undead:GetChildren()) do
Zombs[v.Name] = v:Clone();
v:remove();
end]]
function sendHint(text, player)
removeHint(player)
local msg = Instance.new("Hint")
msg.Name = "LeaderHint"
msg.Text = text
msg.Parent = player.PlayerGui
end
function removeHint(player)
if(player~=nil)and(player.PlayerGui:FindFirstChild("LeaderHint")~=nil)then
player.PlayerGui.LeaderHint:remove()
end
end
function sendMsg(text, player)
removeMsg(player)
local msg = Instance.new("Message")
msg.Name = "LeaderMessage"
msg.Text = text
msg.Parent = player.PlayerGui
end
function removeMsg(player)
if(player~=nil)and(player.PlayerGui:FindFirstChild("LeaderMessage")~=nil)then
player.PlayerGui.LeaderMessage:remove()
end
end
------------------------------ game.workspace.Players.player.PlayerGui.LeaderMessage:remove()
--------------- game.workspace.Players.player.PlayerGui.LeaderHint:remove()
function removeFumeMsg(player)
if(player~=nil)and(player.PlayerGui:FindFirstChild("FumeMessage")~=nil)then
player.PlayerGui.FumeMessage:remove()
end
end
function setCharacterZombie(zombie, player)
print("Zombiefication");
local newUndead =zombie.ZAnimate:Clone()
newUndead.Disabled = false
wait();
local char = player.Character
char["RobloxTeam"]:remove();
char["Sound"]:remove();
char["Animate"]:remove();
newUndead.Parent = char;
wait();
char.creator.Value = player;
end
function onHumanoidDied(humanoid, player)
local stats = player:findFirstChild("leaderstats")
if stats ~= nil then
--local points = stats:findFirstChild("Points")
local dead = player:FindFirstChild("Dead")
--points.Value = points.Value - 1
dead.Value = true
player.TeamColor = zombies.TeamColor
removeFumeMsg(player)
-- do short dance to try and find the killer
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
handleKillCount(humanoid, player)
end
end
function onPlayerRespawn(property, player)
-- need to connect to new humanoid
if property == "Character" and player.Character ~= nil and player.Character.Name == player.Name then
local stats = player:findFirstChild("leaderstats")
if stats ~= nil then
local dead = player:FindFirstChild("Dead")
local class = player:FindFirstChild("Class")
if(dead.Value==true)then
wait(1)
if(player~=nil)and(player.Character~=nil)then
setCharacterZombie(undead[class.Value], player)
else return
end
end
end
humanoid = player.Character.Humanoid
local p = player
local h = humanoid
humanoid.Died:connect(function() onHumanoidDied(h, p) end )
end
end
function getKillerOfHumanoidIfStillInGame(humanoid)
-- returns the player object that killed this humanoid
-- returns nil if the killer is no longer in the game
-- check for kill tag on humanoid - may be more than one - todo: deal with this
local tag = humanoid:findFirstChild("creator")
-- find player with name on tag
if tag ~= nil then
local killer = tag.Value
if killer.Parent ~= nil then -- killer still in game
return killer
end
end
return nil
end
function handleKillCount(humanoid, player)
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
if killer ~= nil then
local stats = killer:findFirstChild("leaderstats")
if stats ~= nil then
local points = stats:findFirstChild("Points")
local dead = killer:FindFirstChild("Dead")
if killer ~= player then
if(dead.Value==false)then
points.Value = points.Value + 21
else
points.Value = points.Value + 22
end
else
points.Value = points.Value - 3
end
end
end
end
function onChatted(msg, speaker)
local class = speaker:FindFirstChild("Class")
if(class==nil)then return end
msg = string.lower(msg)
if(msg=="/zombie")then
class.Value = "Zombie"
elseif(msg=="/fastzombie")then
if(stage.Value>=2)then
class.Value = "FastZombie"
else
sendMsg("Fast Zombie is not unlocked!", speaker)
wait(3)
removeMsg(speaker)
end
elseif(msg=="/kamizombie")then
if(stage.Value>=3)then
class.Value = "KamiZombie"
else
sendMsg("Kamikaze Zombie is not unlocked!", speaker)
wait(3)
removeMsg(speaker)
end
elseif(msg=="/ghostzombie")then
if(stage.Value>=4)then
class.Value = "ghostzombie"
else
sendMsg("Ghost zombie is not unlocked!", speaker)
wait(3)
removeMsg(speaker)
end
elseif(msg=="/fastghostzombie")then
if(stage.Value>=5)then
class.Value = "fastghostzombie"
else
sendMsg("fastghost zombie is not unlocked!", speaker)
wait(3)
removeMsg(speaker)
end
elseif(msg=="/zombieboss")then
if(stage.Value>=6)then
class.Value = "zombieboss"
else
sendMsg("ZombieBOSS! is not unlocked!", speaker)
wait(3)
removeMsg(speaker)
end
end
end
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local points = Instance.new("IntValue")
points.Name = "Points"
points.Value = 0
local dead = Instance.new("BoolValue")
dead.Name = "Dead"
dead.Value = false
local class = Instance.new("StringValue")
class.Name = "Class"
class.Value = "Zombie"
points.Parent = stats
-- VERY UGLY HACK
-- Will this leak threads?
-- Is the problem even what I think it is (player arrived before character)?
while true do
if newPlayer.Character ~= nil then break end
wait(1)
end
dead.Parent = newPlayer
class.Parent = newPlayer
stats.Parent = newPlayer
--newPlayer.Character["Health"]:remove()
if(playing.Value==true)then
shared["Weps"]["Pistol"]:Clone().Parent = newPlayer.Backpack
end
local humanoid = newPlayer.Character.Humanoid
humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )
-- start to listen for new humanoid
newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, newPlayer) end)
stats.Parent = newPlayer
end
game.Players.ChildAdded:connect(onPlayerEntered)
COMMUNITY QUESTION
Can someone make this Filtering enable compatible for me?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
I'm afraid this isn't a request site, but https://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events