Help With Gun Rotation System

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!
    I want to achieve the arsenal feeling. example
    You kill someone
    You get another gun and the old one deletes it self.

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have found none.

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

You could use this or just parent tools to player backpack

Oh wait I see where im going with this.
Ill check if the player has a kill via leaderboard stats Kill 1
And then if it is exactly 1 it will equip another gun and ill add a variable for the old gun!
:smiley: Thanks!

Did you solved your problem? (30 limit)

I’m not sure if I understood everything, but you are just trying to make in sort that if you kill someone, you get their gun and the old one you had gets deleted?

Ohh, missunderstanding, No, Im trying to make an Arsenal of guns. Like if you kill someone you get a new gun from the replicated storage folder.

Not yet,

Do you know why this appears`

I don’t know so much code sorry.

The tool you pick from ReplicatedStorage is a random one or is it in a specific order?

I would prefer a Random one, but if it creates less pain to figure out for you then choose an order.

If you’re using a local script in starter character scripts you could make

local Player = game.Players:GetPlayerFromCharacter(script.Parent)

Oh thank you! (30 limit) (30 limit)

Or just game.Players.LocalPlayer to be even more simple

If you want to make a random gun giver script, you may wanna use the # operator to pick a random gun from a folder you should create in ReplicatedStorage.

local GunFolder = game.ReplicatedStorage:WaitForChild("Guns"):GetChildren()
local randomGun = GunFolder[math.random(1, #GunFolder)]:Clone()
1 Like

Oh my! Thanks now if I implement this into the localscript in SCS it would randomize a gun?

If you implement this on a Local Script, it wouldn’t correctly work. You must go through a Remote Event or directly a server script.

Ohhh alright, (30 limit 30 limit)

Hmmmm it doesnt work.
I’m checking if the Kills stat is 1 then it will equip the gun, aka an AK in RS. doesnt seem to work.

Leaderstats.Kills is an int value not a value, change the killstat variable to Player.leaderstats.Kills.Value

if KillsStat == 1 then

This won’t work because you are trying to tell the script “If this IntValue is equal to 1”, which might seem silly, but you must add a .Value after the KillsStat to effectively tell the script “If this IntValue’s value is equal to 1”.

if KillsStat.Value == 1 then

If you are looking for whenever the value gets updated, a new gun appears, you might wanna use

Sadly, didn’t work. I cant seem to find a solution.