How to make a killstreak multiplier system?

I haven’t seen a single post or YouTube video on this so I thought I’d ask. How would you go about creating a killstreak system like listed below?

3 Player Killstreak: 15 Coins & 1.5x+ XP

5 Player Killstreak: 20 Coins & 2x+ XP

10 Player Killstreak: 25 Coins + 2.5x XP

15 Player Killstreak: 30 Coins + 3x+ XP

20 Player Killstreak: 35 Coins + 3.5x+ XP

25 Player Killstreak: 40 Coins + 4x+ XP

30 Player Killstreak: 45 Coins + 4.5x+ XP

35 Player Killstreak: 50 Coins + 5x+ XP

40 Player Killstreak: 55 Coins + 5.5x+ XP

45 Player Killstreak: 60 Coins + 6x+ XP

50 Player Killstreak: 65 Coins + 6.5x+ XP

55 Player Killstreak: 70 Coins + 7x+ XP

60 Player Killstreak: 80 Coins + 7.5x+ XP

65 Player Killstreak: 85 Coins + 8x+ XP

70 Player Killstreak: 90 Coins + 8.5x+ XP

75 Player Killstreak: 95 Coins + 9x+ XP

80 Player Killstreak: 100 Coins + 9.5x+ XP

85 Player Killstreak: 150 Coins + 10x+ XP

90 Player Killstreak: 200 Coins + 10.5x+ XP

95 Player Killstreak: 250 Coins + 11x+ XP

100 Player Killstreak: 500 Coins + 15x+ XP

First off, how would I go about tracking a player’s killstreak or even making a system like this? I’d want it to reset when a player dies or leaves the game.

I would make a modulescript in ServerStorage called Killstreaks or something

let any serverscript access it through one require and run methods (OnKill, OnDeath, GetXPMult)

you say you want it to reset when a player leaves the game. It wont stay persistent unless you put it through datastores.

How would I make it reset on death? Could you give like a structure or format example on how to do all of this? Im not asking for you to give me a free script, I just wanna see a possible way to execute it

Do you have a kills value/leaderstat that gets gained value when the player gets a kill?

If so, you could add 1 value to the Kill Streak as well and change the value of Kill Streak to 0 when the character is added / CharacterAdded.

This is by no means a tutorial, but what I would do is first make some sort of system that gives bullets (or whatever you’re firing) possession to the player firing it. I would use an Attribute or a StringValue. When the bullet hits an enemy, it would set off a signal, probably a RemoteEvent firing from Server to Client. The same script containing what would happen when the event was fired would have been passed the parameters of who shot the bullet that killed someone. By using the built-in SetAttribute() function (or Instance.new() if you’re using Values), you could set an attribute to the Humanoid of the shooter. I’m pretty sure attributes that are not scripted to being created and parented to any part of a player’s character on respawn will not be replicated after they die. So, each time the player gets a kill, the code changing their killstreak would be something like this:

--NORMAL SCRIPT
player.Humanoid:SetAttribute("Killstreak",0)

-- insert shooting code (should be after a OnServerEvent or something like that I can't remember)
-- after enemy is shot and killed
local currentStreak = player.Humanoid:GetAttribute("Killstreak")
player.Humanoid:SetAttribute("Killstreak", currentstreak + 1)
-- this should not be copied and pasted, it's really sloppy code and should only be used for reference

After that, you could do an if-then loop after each time the killstreak attribute changes by using the AttributeChanged event to see if the killstreak is one of the special numbers you mentioned above, and then proceed to apply the multipliers.

I know this is bad, but I hope it somewhat helps!

1 Like

I’m using a melee system. I think I’ll probably use my killstreak values for kills in some way

Melee probably makes it easier, as the weapon is a tool that is already parented to the attacker. No need for adding StringValues or Attributes to a bullet to signify where it came from.

Glad to hear it’s somewhat easy. I think I’ll set up an intvalue for kills and basically set it up with my currency on kills system. So when a player gets a kill not only will it give them coins but it’ll also add +1 to the killstreak intvalue. Then to reset on death I could set it up so when player health = 0 then killstreak.value = 0. Then I could probably set up a massive if and elseif statement. So if killstreak = blah blah blah then coins,value or whatever = blah blah blah, etc.

I also saw this post which seems to look a lot more efficient and nicer but I’ve gotta figure out how to implement it in this situation

I’m too lazy to read that post, but I believe that if you just create one giant dictionary that has the amount of kills necessary to get each EXP multiplier and to gain coins, then you could just use an in pairs() loop to match the killstreak value to the values in the table.

Not entirely the case,

With Range Weapons, The main Gun is usually handled kn the Client with the inportant calculations like The Raycasting and Bullets are on the Server, so when you fire to the Server, you have direct access to trhe Person who fired the weapon.

1 Like