I have a zombie game and everything works fine except zombie don't get points can someone fix it for me please.

local UnDead = Game.Lighting:FindFirstChild('Zombies')
local Playing = Game.Workspace:FindFirstChild('Playing')
local Stage = Game.Workspace:FindFirstChild('Stage')
local Weapon = Game.Lighting:FindFirstChild('Pistol')
local Humans = Game:FindFirstChild('Humans')
local Zombies = Game.Teams:FindFirstChild('Zombies')

local RemoveHint =(function(Player)
	if (Player and Player.PlayerGui:FindFirstChild('Leader Hint')) then
		Player.PlayerGui['Leader Hint']:remove()
	end
end)

local ShowHint =(function(GameText,Player)
	RemoveHint(Player)
	local Message = Instance.new('Hint')
	Message.Name = 'Leader Hint'
	Message.Text = GameText
	Message.Parent = Player.PlayerGui
end)

local RemoveMessage =(function(Player)
	if (Player and Player.PlayerGui:FindFirstChild('Leader Message')) then
		Player.PlayerGui['Leader Message']:remove()
	end
end)

local ShowMessage =(function(GameText,Player)
	RemoveMessage(Player)
	local Message = Instance.new('Message')
	Message.Name = 'Leader Message'
	Message.Text = GameText
	Message.Parent = Player.PlayerGui
end)

local RemoveFumeMessage =(function(Player)
	if (Player and Player.PlayerGui:FindFirstChild('Fume Message')) then
		Player.PlayerGui['Fume Message']:remove()
	end
end)

local MakeZombie =(function(Zom, Player)
	wait(0)
	local vUnDead = Zom['ZAnimate']:Clone()
	vUnDead.Disabled = false
	Wait(0)
	local Character = Player.Character
	Character['Sound']:remove()
	Character['Animate']:remove()
	Wait(0)
	vUnDead.Parent = Character
	Character['creator'].Value = Player
end)

local GetKiller =(function(Humanoid)
	local Tag = Humanoid:FindFirstChild('creator')
	if (Tag) then
		local Killer = Tag.Value
		if (Killer.Parent) then
			return Killer
		end
	end
	return nil
end)

local KillCount =(function(Humanoid,Player)
	local Killer = GetKiller(Humanoid)
	if (Killer) then
		local Stats = Killer:FindFirstChild('leaderstats')
		if (Stats) then
			local Points = Stats:FindFirstChild('Points')
			local Dead = Killer:FindFirstChild('Dead')
			if Killer ~= Player then
				if not (Dead.Value) then
					Points.Value = Points.Value + 30
				else
					Points.Value = Points.Value + 30
				end
			else
				Points.Value = Points.Value
			end
		end
	end
end)


local HumanoidDied =(function(Humanoid,Player)
	local Stats = Player:FindFirstChild('leaderstats')
	if (Stats) then
		local Dead = Player:FindFirstChild('Dead')
		Dead.Value = true
		Player.TeamColor = Zombies.TeamColor
		RemoveFumeMessage(Player)
		local Killer = GetKiller(Humanoid)
		KillCount(Humanoid,Player)
	end
end)

local PlayerRespawn =(function(Prop,Player)
	if (Prop == 'Character') then
		if (Player.Character 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) then
					Wait(1)
					if (Player) and (Player.Character) then
						MakeZombie(UnDead[Class.Value],Player)
					else 
						return
					end
				end
			end
			Humanoid = Player.Character['Humanoid']
			Humanoid.Died:connect(function() 
				HumanoidDied(Humanoid,Player) 
			end)
		end
	end
end)

Game.Players.PlayerAdded:connect(function(Player)
	while true do
		if (Player.Character) then 
			break 
		end
		Wait(1)
	end
	local Stats = Instance.new('IntValue',Player)
	Stats.Name = 'leaderstats'
	local Points = Instance.new('IntValue',Stats)
	Points.Name = 'Points'
	Points.Value = 0
	local Dead = Instance.new('BoolValue',Player)
	Dead.Name = 'Dead'
	Dead.Value = false
	local Class = Instance.new('StringValue',Player)
	Class.Name = 'Class'
	Class.Value = 'Zombie'
	if (Playing.Value) then
		Weapon:Clone().Parent = Player.Backpack
	end
	local Humanoid = Player.Character:FindFirstChild('Humanoid')
	Humanoid.Died:connect(function() 
		HumanoidDied(Humanoid,Player) 
	end)
	Player.Changed:connect(function(Prop) 
		PlayerRespawn(Prop,Player)
	end)
	Player.Chatted:connect(function(Message,Recipient) 
		local Class = Player:FindFirstChild('Class')
		if not (Class) then 
			return 
		end
		Message = string.lower(Message)
		if (Message == '/zombie') then
			Class.Value = 'Zombie'
		elseif (Message == '/fastzombie') then
			if (Stage.Value >= 2) then
				Class.Value = 'Fast Zombie'
			else
				ShowMessage('Fast Zombie is not unlocked!',Player)
				Wait(3)
				RemoveMessage(Player)
			end
		elseif (Message == '/kamizombie') then
			if (Stage.Value >= 3) then
				Class.Value = 'Kami-Zombie'
			else
				ShowMessage('Kami-Zombie is not unlocked!',Player)
				Wait(3)
				RemoveMessage(Player)
			end
		elseif (Message=='/ghostzombie') then
			if (Stage.Value >= 4) then
				Class.Value = 'Ghost Zombie'
			else
				ShowMessage('Ghost Zombie is not unlocked!',Player)
				Wait(3)
				RemoveMessage(Player)
			end
		elseif (Message == '/fastghostzombie') then
			if (Stage.Value >= 5) then
				Class.Value = 'Fast Ghost Zombie'
			else
				ShowMessage('Fast Ghost Zombie is not unlocked!',Player)
				Wait(3)
				RemoveMessage(Player)
			end
		elseif (Message == '/zombieboss') then
			if (Stage.Value >= 6) then
				Class.Value = 'Zombie Boss'
			else
				ShowMessage('Zombie Boss! is not unlocked!',Player)
				Wait(3)
				RemoveMessage(Player)
			end
		end 
	end)
end)

1 comment

0

I think some context is needed