Please help me. No weapons are issued to players

-- Server-side script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local workspace = game:GetService("Workspace")
local lobby = workspace:WaitForChild("Spawn")
local maps = ReplicatedStorage.Maps:GetChildren()
local status = ReplicatedStorage.Status
local duelteam = game.Teams.Duelists
local lobbyteam = game.Teams.Lobby
local giveweapons = 1
local weapons = ReplicatedStorage.Weapons

local function giveweapon(player)
	for i = 1, giveweapons do
		while true do
			local rand = math.random(1, #weapons:GetChildren())
			local randomWeapon = weapons:GetChildren()[rand]

			if not player.Backpack:FindFirstChild(randomWeapon.Name) then
				randomWeapon:Clone().Parent = player.Backpack
				break
			end
		end
	end
end

while true do
	local players = Players:GetPlayers()
	for _, player in pairs(players) do
		player.Team = lobbyteam
	end
	if #players >= 2 then
		for i = 5, 0, -1 do
			status.Value = "Intermission: " .. i
			wait(1)
		end
		local chosenmap = maps[math.random(1, #maps)]
		local clonemap = chosenmap:Clone()
		clonemap.Parent = workspace
		status.Value = "Map: " .. clonemap.Name
		wait(2)
		local chosenplayer1 = players[math.random(1, #players)]
		local chosenplayer2 = nil
		repeat
			chosenplayer2 = players[math.random(1, #players)]
		until chosenplayer2 ~= chosenplayer1
		chosenplayer1.Character:SetPrimaryPartCFrame(clonemap.Teleport1.CFrame)
		chosenplayer1.Team = duelteam
		chosenplayer2.Character:SetPrimaryPartCFrame(clonemap.Teleport2.CFrame)
		chosenplayer2.Team = duelteam
		local function handlePlayerDeath(player)
			player.Team = lobbyteam
		end
		chosenplayer1.Character:WaitForChild("Humanoid").Died:Connect(function()
			handlePlayerDeath(chosenplayer1)
		end)
		chosenplayer2.Character:WaitForChild("Humanoid").Died:Connect(function()
			handlePlayerDeath(chosenplayer2)
		end)
		for i = 10, 0, -1 do
			status.Value = "Liquidation: " .. i
			local playing = {}
			if chosenplayer1.Team == duelteam then
				table.insert(playing, chosenplayer1)
			end
			if chosenplayer2.Team == duelteam then
				table.insert(playing, chosenplayer2)
			end
			if #playing == 0 then
				status.Value = "Draw"
				wait(2)
				break
			end
			if #playing == 1 then
				status.Value = playing[1].Name .. " has WON!"
				wait(2)
				break
			end
			wait(1)
			if i == 0 then
				local sound = ReplicatedStorage:WaitForChild("kid fav blinker")
				sound:Play()
				wait(0.7)
				chosenplayer1.Character.Humanoid.Health = 0
				chosenplayer2.Character.Humanoid.Health = 0
				status.Value = "Explosive draw!"
				wait(2)
			end
		end
		clonemap:Destroy()
		chosenplayer1.Character:SetPrimaryPartCFrame(lobby.Tp1.CFrame)
		chosenplayer1.Team = lobbyteam
		chosenplayer2.Character:SetPrimaryPartCFrame(lobby.Tp2.CFrame)
		chosenplayer2.Team = lobbyteam
	else
		status.Value = "You're unlikely to play alone."
		wait(0.5)
		status.Value = "You're unlikely to play alone.."
		wait(0.5)
		status.Value = "You're unlikely to play alone..."
		wait(0.5)
	end
end
-- Client-side script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remote = ReplicatedStorage.PickWeapon

-- Call the remote event here
remote:FireServer()

1 Like