Advertisement
Cat_in_the_hat

Kill streak with give player +2 speed on each kill and +1 damge on each kill

Dec 23rd, 2023
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. local kills = {}
  2. local labels = {}
  3. local damageCooldown = {}
  4.  
  5. local lb = UIService.createLeaderboard()
  6.  
  7. local configuration = {
  8. OnlyPlayer = false
  9. }
  10.  
  11. local function createAndUpdateLabel(player)
  12. local playerEntity = player:getEntity()
  13. if playerEntity and playerEntity:isAlive() then
  14. kills[player] = 0
  15. local killsLabel = UIService.createTextLabel("🔥 " .. kills[player], playerEntity:getPosition())
  16.  
  17. killsLabel:setBackgroundColor(Color3.fromRGB(0, 0, 0))
  18. killsLabel:setBackgroundTransparency(0.1)
  19. killsLabel:setTextColor(Color3.fromRGB(255, 255, 255))
  20. killsLabel:setSize(UDim2.fromScale(10, 2))
  21. killsLabel:setFont(Font.Arcade)
  22.  
  23. task.spawn(function()
  24. while playerEntity:isAlive() do
  25. wait(0.01)
  26. killsLabel:setPosition(playerEntity:getPosition() + Vector3.new(0, 5, 0))
  27. end
  28. killsLabel:destroy()
  29. end)
  30.  
  31. labels[player] = killsLabel
  32. end
  33. end
  34.  
  35. for _, player in pairs(PlayerService.getPlayers()) do
  36. if not player then continue end
  37. if kills[player] == nil then
  38. kills[player] = 0
  39. end
  40.  
  41. lb:addKey(player, kills[player])
  42. lb:addScore(player, kills[player])
  43.  
  44. createAndUpdateLabel(player)
  45. end
  46.  
  47. Events.EntityDeath(function(event)
  48. local entity = event.entity
  49. local killer = event.killer
  50. if not killer then return end
  51. local player = killer:getPlayer()
  52. if not player then return end
  53.  
  54. if not damageCooldown[player] or tick() - damageCooldown[player] > 1 then
  55. damageCooldown[player] = tick()
  56. kills[player] = kills[player] + 1
  57. lb:setScore(player, kills[player])
  58.  
  59. local currentLabel = labels[player]
  60. if currentLabel then
  61. currentLabel:setText("🔥 " .. kills[player])
  62. end
  63.  
  64. wait(1)
  65.  
  66. local currentMultiplier = player:getSpeedMultiplier()
  67. player:registerSpeedMultiplier(player.name, currentMultiplier + 2) -- replace 2 on how much speed it should add on each kill
  68.  
  69. Events.EntityDamage(function(damageEvent)
  70. if damageEvent.fromEntity:getPlayer() == player then
  71. damageEvent.damage = damageEvent.damage + 1
  72. end
  73. end)
  74. end
  75. end) -- replace 1 on how much damage it should add on each kill
  76.  
  77. Events.EntitySpawn(function(event)
  78. local player = event.entity:getPlayer()
  79. if player then
  80. createAndUpdateLabel(player)
  81. end
  82. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement