I want to make a game that would be Arsenal if it was made in 2012. However, I don’t know how to script someone getting a new gun after a kill/assist. It is also not on the internet anywhere. I don’t need to know how to make the entire arsenal game, just how to code a standard round. Can you please guide me?
Part 1
I don’t know what your script setup is, but I have made a general guide. The first thing you want to do is find when an enemy dies. I don’t know what your script setup is like though. All you have to do is make a check whenever you hit someone with a ray, projectile, or whatever you’re using. Then, just check if the person hit has no health left after applying damage.
Part 2
Now we need to get a random weapon. First, you should create a folder in replicated storage with all your weapons.
Next step is to go into the script of the weapon (or maybe make it a module) and we are going to script a random weapon chooser.
Lets start with a table:
local weapons = {"ar", "pistol", "shotgun"}
Here is a basic table that contains string values that share a common name with the physical tool counterpart (this is important).
Now we need to randomize the chosen weapon.
local weapons = {"ar", "pistol", "shotgun"}
local random = math.random(1, #weapons) --the # returns a number that is the amount of values in a table
local wep = weapons[random] --this gets the weapon name from the table
Finally, we need to actually find the physical weapon.
local weapons = {"ar", "pistol", "shotgun"}
local random = math.random(1, #weapons) --the # returns a number that is the amount of values in a table
local wep = weapons[random] --this gets the weapon name from the table
local newWeapon = game.ReplicatedStorage.weapons[wep] -- this is the tool
Now we are done! I would strongly recommend you put this in a function and just call it from the part in the script that checks if the enemy is killed.