Advertisement
Cat_in_the_hat

Kill streack with speed and damge added

Dec 23rd, 2023
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. local damageMoreOnEachThreshold = 5 -- meaning each time they hit that number add to the player damge the add more damge number
  2. local addMoreDamageOnEachThreshold = 4 -- each time they hit the damge more number add to the player that number
  3. local eachKillSpeedByThreshold = 3 -- meaning each time they kill that many people add to the player speed the number on add speed addSpeedMoreOnEachThreshold = 1.5 -- each time they hit the speed more number add to the player that number
  4.  
  5. local kills = {}
  6. local labels = {}
  7. local playerDamage = {}
  8.  
  9. local lb = UIService.createLeaderboard()
  10.  
  11. local configuration = {
  12. OnlyPlayer = false
  13. }
  14.  
  15. local function damageMoreOnEach(player)
  16. if kills[player] % damageMoreOnEachThreshold == 0 then
  17. playerDamage[player] = playerDamage[player] + addMoreDamageOnEachThreshold
  18. end
  19. end
  20.  
  21. local function addMoreDamageOnEach(player)
  22. return addMoreDamageOnEachThreshold
  23. end
  24.  
  25. local function addSpeedMoreOnEach(player)
  26. player:registerSpeedMultiplier("speed-boost", addSpeedMoreOnEachThreshold)
  27. end
  28.  
  29. local function removeSpeedMoreOnEach(player)
  30. player:removeSpeedMultiplier("speed-boost")
  31. end
  32.  
  33. local function createAndUpdateLabel(player)
  34. local playerEntity = player:getEntity()
  35. if playerEntity and playerEntity:isAlive() then
  36. kills[player] = 0
  37. playerDamage[player] = 0
  38.  
  39. local killsLabel = UIService.createTextLabel("🔥 " .. kills[player], playerEntity:getPosition())
  40.  
  41. killsLabel:setBackgroundColor(Color3.fromRGB(0, 0, 0))
  42. killsLabel:setBackgroundTransparency(0.1)
  43. killsLabel:setTextColor(Color3.fromRGB(255, 255, 255))
  44. killsLabel:setSize(UDim2.fromScale(10, 2))
  45. killsLabel:setFont(Font.Arcade)
  46.  
  47. task.spawn(function()
  48. while playerEntity:isAlive() do
  49. wait(0.01)
  50. killsLabel:setPosition(playerEntity:getPosition() + Vector3.new(0, 5, 0))
  51. end
  52. killsLabel:destroy()
  53. end)
  54.  
  55. labels[player] = killsLabel
  56. end
  57. end
  58.  
  59. for _, player in pairs(PlayerService.getPlayers()) do
  60. if not player then continue end
  61. if kills[player] == nil then
  62. kills[player] = 0
  63. end
  64.  
  65. lb:addKey(player, kills[player])
  66. lb:addScore(player, kills[player])
  67.  
  68. createAndUpdateLabel(player)
  69. end
  70.  
  71. Events.EntityDeath(function(event)
  72. local entity = event.entity
  73. local killer = event.killer
  74. if not killer then return end
  75. local player = killer:getPlayer()
  76. if not player then return end
  77.  
  78. kills[player] = kills[player] + 1
  79. lb:setScore(player, kills[player])
  80.  
  81. local currentLabel = labels[player]
  82. if currentLabel then
  83. currentLabel:setText("🔥 " .. kills[player])
  84. damageMoreOnEach(player)
  85. if kills[player] % eachKillSpeedByThreshold == 0 then
  86. addSpeedMoreOnEach(player)
  87. end
  88. end
  89. end)
  90.  
  91. Events.EntityDamage(function(event)
  92. local player = event.entity:getPlayer()
  93. if player then
  94. event.damage = event.damage + addMoreDamageOnEach(player)
  95. end
  96. end)
  97.  
  98. Events.EntitySpawn(function(event)
  99. local player = event.entity:getPlayer()
  100. if player then
  101. createAndUpdateLabel(player)
  102. end
  103. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement