Random player choser problem

I made a round system w/ random map selector, the maps have 2 spawn in them named “Spawn” and “KillerSpawn”, the “Spawn” is for the players to teleport to when map is loaded and the “KillerSpawn” is where the random player is teleported to, but the problem is I think it cant get the character of the random player but it can get the character of all other player since it gave me this error

Script
local maps = game.ReplicatedStorage.Maps:GetChildren()
local currentmap = workspace:WaitForChild("CurrentMap")
local chosenmap = script:WaitForChild("ChosenMap")
local spawner = workspace.Lobby.SpawnLocation

local shooter = nil

function chooseMap()
	local choices = {}
	for i = 1, #maps do
		if maps[i]:IsA("Model") then
			table.insert(choices, maps[i])
		end
	end
	local picked = math.random(1,#maps)
	chosenmap.Value = choices[picked].Name
end

function loadMap()
	local map = game.ReplicatedStorage.Maps:FindFirstChild(chosenmap.Value):Clone()
	map.Parent = currentmap
end

function deleteMap()
	shooter = nil
	for i,v in pairs(currentmap:GetChildren()) do
		if v:IsA("Model") then
			v:Destroy()
		end
	end
end

function teleportPlayers()
	local players = game.Players:GetPlayers()
	for i,v in pairs(players) do
		v.Character.HumanoidRootPart.CFrame = currentmap:FindFirstChild(chosenmap.Value).Spawn.CFrame
	end
end

function teleportShooter()
	local players = game.Players:GetPlayers()
	local randomPlayer = math.random(1, #players)
	shooter = randomPlayer
	randomPlayer.Character.HumanoidRootPart.CFrame = currentmap:FindFirstChild(chosenmap.Value).KillerSpawn.CFrame
end

function teleportBack()
	local players = game.Players:GetPlayers()
	for i,v in pairs(players) do
		if players ~= shooter then
			v.Character.HumanoidRootPart.CFrame = spawner.CFrame
		end
	end
end

game.ReplicatedStorage.LoadMap.Event:Connect(function()
	chooseMap()
	loadMap()
	wait(1)
	teleportPlayers()
	teleportShooter()
end)

game.ReplicatedStorage.GameEnd.Event:Connect(function()
	deleteMap()
	teleportBack()
end)

please help me, thank you

randomPlayer contains the index of the random player in the players table, you need to use that index to get the player

shooter = players[randomPlayer]