How to make an arsenal like gun rotation system after kill

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    1. I want to know how to make it like, if you kill someone with a gun you get another gun.
  2. What is the issue? Include screenshots / videos if possible!
    Really not an issue.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Yes I have no solutions.
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
4 Likes
local Guns = {
  "Rifle",
  "Lazer",
  "Pistol"
}

local KillsTable = {}

game.Players.PlayerAdded:Connect(function()
  KillsTable[player.Name] = 0
  -- somehow detect when someone is killed
  local Killer = --how you detect the killer
  if Killer then
    KillsTable[Killer.Name] += 1
    local old_tool = Killer.Backpack:FindFirstChildOfClass("Tool")
    if old_tool then
      old_tool:Destroy()
    end
    local new_tool = Guns[KillsTable[Killer.Name]]
    new_tool:Clone().Parent = Killer.Backpack
  end
end
9 Likes

Oh well, thats insane, and I’m not so good at coding.

3 Likes

Please put this in #help-and-feedback:game-design-support next time. In the scripting support template, it states to not ask people to design entire systems for you.

2 Likes

Did it, instantly thank you for noticing.

2 Likes

No problem, be sure to read and remember the rules for categories when you are about to make a topic, so you know which category to put it in.

1 Like

Yes, I’ll have that in mind thank you.

1 Like

What service/folder do we put it in on roblox studio?

2 Likes