We are both new to scripting and decided to attempt to create a game which gives a random gun sword and miscellaneous item on each spawn. We have tried pretty much every tutorial we could find and none seem to work if anyone knows how to help us with this I would be very grateful. :)
You could put all the weapons in a dedicated folder in ServerStorage or somewhere and use GetChildren() to get a table with all the weapons. You can use the math.random function to choose a random weapon from the table every time and clone it to the player
local ServerStorage = game:GetService("ServerStorage") local Players = game:GetService("Players") -- table with all the weapons local allWeapons = ServerStorage.Weapons:GetChildren() Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) -- whenever somebody spawns or respawns, this will run -- select a random weapon, from 1 (the beginning of the table) to the last value in the table, clone it, and put it in the player's backpack local randomWeapon = allWeapons[math.random(1, #allWeapons)]:Clone() randomWeapon.Parent = player.Backpack end) end)