i scripted it so that when a player joins the game it picks a random player between 0 and the amount of player and then when the player is chosen the tool is gonna be inside the backpack of the chosen player it doesnt work its not putting the tool inside the backpack but it still prints the chosen player
here is the script:
local tool = game.ReplicatedStorage.Minigun
local Players = game.Players
local function pickRandomPlayer()
game.Players.PlayerAdded:Connect(function()
local chosen = Players:GetChildren()[math.random(0, #Players:GetChildren())]
if chosen ~= nil then
print(chosen)
tool.Parent = chosen.Backpack
else
end
end)
end
pickRandomPlayer()
