Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- oid.WalkSpeed = 15
- player.Character.Humanoid.Health = 120
- end
- end
- end
- function getKillerOfHumanoidIfStillInGame(humanoid)
- local tag = humanoid:findFirstChild("creator")
- if tag ~= nil then
- local killer = tag.Value
- if killer.Parent ~= nil then
- 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 kills = stats:findFirstChild("KOs")
- local gold = stats:findFirstChild("Gold")
- local m = Instance.new("Hint") ---Here---
- m.Parent = game.Workspace
- m.Text = player.Name .. " Was Killed By " .. killer.Name ---End---
- wait(5)
- m.Parent = nil
- if killer ~= player then
- if player.TeamColor == game.Teams.King.TeamColor then
- if kingdebounce then return end
- local m = Instance.new("Hint")
- m.Parent = game.Workspace
- m.Text = player.Name .. " Was Killed By " .. killer.Name .. " Is The New King"
- local p = game.Players:GetChildren()
- for i = 1,#p do
- if p[i].Character~=nil then
- p[i].Character:BreakJoints()
- p[i].leaderstats.Gold.Value = p[i].leaderstats.Gold.Value + 5
- p[i].leaderstats.WOs.Value = p[i].leaderstats.WOs.Value - 1
- end
- end
- kills.Value = kills.Value + 1
- gold.Value = gold.Value + 5
- killer.TeamColor = game.Teams.King.TeamColor
- player.TeamColor = game.Teams.Knights.TeamColor
- wait(5)
- m.Parent = nil
- kingdebounce = true
- wait(7)
- kingdebounce = false
- else
- kills.Value = kills.Value + 1
- gold.Value = gold.Value + 5
- end
- end
- end
- end
- end
- function onEntered(newPlayer)
- newPlayer.Neutral = false
- newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
- local p = game.Players:GetChildren()
- for i = 1,#p do
- if p[i].TeamColor == game.Teams.King.TeamColor then
- king = p[i]
- end
- end
- if king == nil then
- newPlayer.TeamColor = game.Teams.King.TeamColor
- else
- newPlayer.TeamColor = game.Teams.Knights.TeamColor
- end
- local stats = Instance.new("IntValue")
- stats.Name = "leaderstats"
- local kills = Instance.new("IntValue")
- kills.Name = "KOs"
- kills.Value = 0
- local deaths = Instance.new("IntValue")
- deaths.Name = "WOs"
- deaths.Value = 0
- local gold = Instance.new("IntValue")
- gold.Name = "Gold"
- gold.Value = 10
- kills.Parent = stats
- deaths.Parent = stats
- gold.Parent = stats
- while true do
- if newPlayer.Character~=nil then break end
- wait()
- end
- if newPlayer.TeamColor == game.Teams.King.TeamColor then
- newPlayer.Character.Humanoid.MaxHealth = 120
- newPlayer.Character.Humanoid.Health = 120
- newPlayer.Character.Humanoid.WalkSpeed = 15
- end
- local humanoid = newPlayer.Character.Humanoid
- humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end)
- newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end)
- stats.Parent = newPlayer
- local m = Instance.new("Hint")
- m.Parent = newPlayer
- m.Text = "KING OF THE CASTLE"
- wait(4)
- m.Parent = nil
- end
- function onLeaving(player)
- if player.TeamColor == game.Teams.King.TeamColor then
- local p = game.Players:GetChildren()
- local pl = p[math.random(1,#p)]
- if pl~=player then
- pl.TeamColor = game.Teams.King.TeamColor
- else
- pl = p[math.random(1,#p)]
- pl.TeamColor = game.Teams.King.TeamColor
- end
- end
- end
- game.Players.ChildAdded:connect(onEntered)
- game.Players.ChildRemoved:connect(onLeaving)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement