Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local kills = {}
- local labels = {}
- local damageCooldown = {}
- local lb = UIService.createLeaderboard()
- local configuration = {
- OnlyPlayer = false
- }
- local function createAndUpdateLabel(player)
- local playerEntity = player:getEntity()
- if playerEntity and playerEntity:isAlive() then
- kills[player] = 0
- local killsLabel = UIService.createTextLabel("🔥 " .. kills[player], playerEntity:getPosition())
- killsLabel:setBackgroundColor(Color3.fromRGB(0, 0, 0))
- killsLabel:setBackgroundTransparency(0.1)
- killsLabel:setTextColor(Color3.fromRGB(255, 255, 255))
- killsLabel:setSize(UDim2.fromScale(10, 2))
- killsLabel:setFont(Font.Arcade)
- task.spawn(function()
- while playerEntity:isAlive() do
- wait(0.01)
- killsLabel:setPosition(playerEntity:getPosition() + Vector3.new(0, 5, 0))
- end
- killsLabel:destroy()
- end)
- labels[player] = killsLabel
- end
- end
- for _, player in pairs(PlayerService.getPlayers()) do
- if not player then continue end
- if kills[player] == nil then
- kills[player] = 0
- end
- lb:addKey(player, kills[player])
- lb:addScore(player, kills[player])
- createAndUpdateLabel(player)
- end
- Events.EntityDeath(function(event)
- local entity = event.entity
- local killer = event.killer
- if not killer then return end
- local player = killer:getPlayer()
- if not player then return end
- if not damageCooldown[player] or tick() - damageCooldown[player] > 1 then
- damageCooldown[player] = tick()
- kills[player] = kills[player] + 1
- lb:setScore(player, kills[player])
- local currentLabel = labels[player]
- if currentLabel then
- currentLabel:setText("🔥 " .. kills[player])
- end
- wait(1)
- local currentMultiplier = player:getSpeedMultiplier()
- player:registerSpeedMultiplier(player.name, currentMultiplier + 2) -- replace 2 on how much speed it should add on each kill
- Events.EntityDamage(function(damageEvent)
- if damageEvent.fromEntity:getPlayer() == player then
- damageEvent.damage = damageEvent.damage + 1
- end
- end)
- end
- end) -- replace 1 on how much damage it should add on each kill
- Events.EntitySpawn(function(event)
- local player = event.entity:getPlayer()
- if player then
- createAndUpdateLabel(player)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement