Giving one player one weapon randomly

and what about the cloning of the weapon?

I think it’s fine, but you need to update the table and remove the weapon.

Sword:Clone().Parent = game:GetService('Players'):GetPlayers()[math.random(1,#game:GetService('Players'):GetPlayers()).Backpack
1 Like

You’re bringing my hope back in humanity dand.
I would make this like that
otherfolders:GetChildren()[math.random(#otherfolders:GetChildren())]:GetChildren()[math.random(#swords:GetChildren())]:Clone().Parent = game.Players:GetChildren()[math.random(#game.Players:GetChildren())].Backpack

Uh I think you forgot to close the square brackets so it gave me an error I do not were to put it my self…

1 Like

so one of the players got a weapon when I did this

weapon:Clone().Parent = game:GetService('Players'):GetPlayers()[math.random(1,#game:GetService('Players'):GetPlayers())].Backpack

I am guessing it gave to 1 player only because it’s not in a for loop so i will try that and see

so when I put

weapon:Clone().Parent = game:GetService('Players'):GetPlayers()[math.random(1,#game:GetService('Players'):GetPlayers())].Backpack

in a for loop the same player ended up with 2 weapons I am so confused

so make module or table for that and check if this player was already given weapon.
and name indexes by their player names and put some value

so I ended up so how (I don’t know how) manged to make it work
In case you are wondering I put this inside the for loop

local weapon = weps[math.random(1,#weps)]
weapon:Clone().Parent = player.Backpack