I'm trying to finish my game. However, there is an issue that occurs. The script gives only ONE player a sword, instead of everyone in the server.
Swords = game.ReplicatedStorage.Swords:GetChildren() --Select a random sword selected = Swords[math.random(1,#Swords)] selected:Clone().Parent = game.Players.LocalPlayer.Backpack
for i,v in pairs (game.Players:GetPlayers()) do Swords = game.ReplicatedStorage.Swords:GetChildren() --Select a random sword selected = Swords[math.random(1,#Swords)] selected:Clone().Parent = v.Backpack end
I used a pairs loop to get all the players in Players and ran the function to each one of them. This should only be ran once though, so it'd be best in a server script. (not a localscript)