Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Made by Real_IceyDev (lceyDex) --
- -- This is my kill feed & kill leaderboard, you shouldn't take this if you don't know how to properly edit it. It's meant as a showcase lol --
- victimname = "Player1"
- killname = "Player2"
- function update()
- player = game.Players:GetChildren()
- for i = 1, #player do
- up = player[i].PlayerGui.Update
- up1 = up.Up1
- up2 = up.Up2
- up3 = up.Up3
- up4 = up.Up4
- up5 = up.Up5
- up1.Text = up2.Text
- up2.Text = up3.Text
- up3.Text = up4.Text
- up4.Text = up5.Text
- up5.Text = "" ..victimname.. " was killed by " ..killname.. ""
- end
- ups = game.StarterGui.Update
- ups1 = ups.Up1
- ups2 = ups.Up2
- ups3 = ups.Up3
- ups4 = ups.Up4
- ups5 = ups.Up5
- ups1.Text = ups2.Text
- ups2.Text = ups3.Text
- ups3.Text = ups4.Text
- ups4.Text = ups5.Text
- ups5.Text = "" ..victimname.. " was killed by " ..killname.. ""
- end
- function onPlayerEntered(newPlayer)
- local stats = Instance.new("IntValue")
- stats.Name = "leaderstats"
- local score = Instance.new("IntValue")
- score.Name = "Kills"
- score.Value = 0
- local spree = Instance.new("IntValue")
- spree.Name = "Deaths"
- spree.Value = 0
- score.Parent = stats
- spree.Parent = stats
- while true do
- if newPlayer.Character ~= nil then break end
- wait(5)
- 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
- end
- function Send_DB_Event_Died(victim, killer)
- local killername = "no one"
- if killer ~= nil then killername = killer.Name end
- print("DIED EVENT: ", victim.Name, " KILLED by ", killername)
- victimname = victim.Name
- killname = killername
- update()
- if shared["deaths"] ~= nil then
- shared["deaths"](victim, killer)
- print("SENT DB DEATH EVENT")
- end
- end
- function Send_DB_Event_Kill(killer, victim)
- print("KILL EVENT. ", killer.Name, " BLOXXED ", victim.Name)
- if shared["kills"] ~= nil then
- shared["kills"](killer, victim)
- print("SENT DB KILL EVENT")
- end
- end
- function onHumanoidDied(humanoid, player)
- local stats = player:findFirstChild("leaderstats")
- if stats ~= nil then
- local score = stats:findFirstChild("Kills")
- local spree = stats:findFirstChild("Deaths")
- spree.Value = 0
- score.Value = score.Value - 1
- local killer = getKillerOfHumanoidIfStillInGame(humanoid)
- Send_DB_Event_Died(player, killer)
- handleKillCount(humanoid, player)
- end
- end
- function onPlayerRespawn(property, player)
- if property == "Character" and player.Character ~= nil then
- local humanoid = player.Character.Humanoid
- local p = player
- local h = humanoid
- humanoid.Died:connect(function() onHumanoidDied(h, p) 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 score = stats:findFirstChild("Kills")
- local spree = stats:findFirstChild("Deaths")
- score.Value = score.Value + 2
- spree.Value = spree.Value + 1
- else
- spree.Value = 0
- score.Value = score.Value - 1
- end
- Send_DB_Event_Kill(killer, player)
- end
- end
- game.Players.ChildAdded:connect(onPlayerEntered)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement