Why is this giving everyone a weapon?
So im trying to give one person a weapon, but its giving everyone a weapon when i start a test server in studio
1 | local choose = game.Players:GetPlayers() [ math.random( 1 ,#game.Players:GetPlayers()) ] |
3 | if choose:FindFirstChild( "Backpack" ) then |
4 | game.ReplicatedStorage.Luger:Clone().Parent = choose.Backpack; |
EDIT
thats not all of it though,
01 | local players = game.Players:GetPlayers() |
09 | if (game.Players.NumPlayers < = 1 ) then |
11 | game.StarterGui.gui.LocalScript.Event:Fire() |
13 | if (game.Players.NumPlayers > = 2 ) then |
16 | target = CFrame.new( 0 , 50 , 0 ) |
17 | for i, player in ipairs (game.Players:GetChildren()) do |
19 | if player.Character and player.Character:FindFirstChild( "Torso" ) then |
21 | player.Character.Torso.CFrame = target + Vector 3. new( 0 , i * 5 , 0 ) |
25 | local choose = game.Players:GetPlayers() [ math.random( 1 ,#game.Players:GetPlayers()) ] |
27 | if choose:FindFirstChild( "Backpack" ) then |
28 | game.ReplicatedStorage.Luger:Clone().Parent = choose.Backpack; |
EDIT 2
It seems to be giving out a weapon per player, and sometimes gives someones weapon to another person