Advertisement
Beasrt

Untitled

Mar 29th, 2015
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. oid.WalkSpeed = 15
  2. player.Character.Humanoid.Health = 120
  3. end
  4. end
  5. end
  6.  
  7. function getKillerOfHumanoidIfStillInGame(humanoid)
  8. local tag = humanoid:findFirstChild("creator")
  9. if tag ~= nil then
  10. local killer = tag.Value
  11. if killer.Parent ~= nil then
  12. return killer
  13. end
  14. end
  15. return nil
  16. end
  17.  
  18. function handleKillCount(humanoid, player)
  19. local killer = getKillerOfHumanoidIfStillInGame(humanoid)
  20. if killer ~= nil then
  21. local stats = killer:findFirstChild("leaderstats")
  22. if stats ~= nil then
  23. local kills = stats:findFirstChild("KOs")
  24. local gold = stats:findFirstChild("Gold")
  25. local m = Instance.new("Hint") ---Here---
  26. m.Parent = game.Workspace
  27. m.Text = player.Name .. " Was Killed By " .. killer.Name ---End---
  28. wait(5)
  29. m.Parent = nil
  30. if killer ~= player then
  31. if player.TeamColor == game.Teams.King.TeamColor then
  32. if kingdebounce then return end
  33. local m = Instance.new("Hint")
  34. m.Parent = game.Workspace
  35. m.Text = player.Name .. " Was Killed By " .. killer.Name .. " Is The New King"
  36. local p = game.Players:GetChildren()
  37. for i = 1,#p do
  38. if p[i].Character~=nil then
  39. p[i].Character:BreakJoints()
  40. p[i].leaderstats.Gold.Value = p[i].leaderstats.Gold.Value + 5
  41. p[i].leaderstats.WOs.Value = p[i].leaderstats.WOs.Value - 1
  42. end
  43. end
  44. kills.Value = kills.Value + 1
  45. gold.Value = gold.Value + 5
  46. killer.TeamColor = game.Teams.King.TeamColor
  47. player.TeamColor = game.Teams.Knights.TeamColor
  48. wait(5)
  49. m.Parent = nil
  50. kingdebounce = true
  51. wait(7)
  52. kingdebounce = false
  53. else
  54. kills.Value = kills.Value + 1
  55. gold.Value = gold.Value + 5
  56. end
  57. end
  58. end
  59. end
  60. end
  61.  
  62.  
  63. function onEntered(newPlayer)
  64. newPlayer.Neutral = false
  65. newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
  66. local p = game.Players:GetChildren()
  67. for i = 1,#p do
  68. if p[i].TeamColor == game.Teams.King.TeamColor then
  69. king = p[i]
  70. end
  71. end
  72. if king == nil then
  73. newPlayer.TeamColor = game.Teams.King.TeamColor
  74. else
  75. newPlayer.TeamColor = game.Teams.Knights.TeamColor
  76. end
  77. local stats = Instance.new("IntValue")
  78. stats.Name = "leaderstats"
  79. local kills = Instance.new("IntValue")
  80. kills.Name = "KOs"
  81. kills.Value = 0
  82. local deaths = Instance.new("IntValue")
  83. deaths.Name = "WOs"
  84. deaths.Value = 0
  85. local gold = Instance.new("IntValue")
  86. gold.Name = "Gold"
  87. gold.Value = 10
  88. kills.Parent = stats
  89. deaths.Parent = stats
  90. gold.Parent = stats
  91. while true do
  92. if newPlayer.Character~=nil then break end
  93. wait()
  94. end
  95. if newPlayer.TeamColor == game.Teams.King.TeamColor then
  96. newPlayer.Character.Humanoid.MaxHealth = 120
  97. newPlayer.Character.Humanoid.Health = 120
  98. newPlayer.Character.Humanoid.WalkSpeed = 15
  99.  
  100. end
  101. local humanoid = newPlayer.Character.Humanoid
  102. humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end)
  103. newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end)
  104. stats.Parent = newPlayer
  105. local m = Instance.new("Hint")
  106. m.Parent = newPlayer
  107. m.Text = "KING OF THE CASTLE"
  108. wait(4)
  109. m.Parent = nil
  110. end
  111.  
  112. function onLeaving(player)
  113. if player.TeamColor == game.Teams.King.TeamColor then
  114. local p = game.Players:GetChildren()
  115. local pl = p[math.random(1,#p)]
  116. if pl~=player then
  117. pl.TeamColor = game.Teams.King.TeamColor
  118. else
  119. pl = p[math.random(1,#p)]
  120. pl.TeamColor = game.Teams.King.TeamColor
  121. end
  122. end
  123. end
  124.  
  125.  
  126. game.Players.ChildAdded:connect(onEntered)
  127. game.Players.ChildRemoved:connect(onLeaving)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement