Simply set a variable outside of the scope wait for the player to be added pass in the newly added player. Assign the variable to the passed in player variable then return the variable to the scope so it can be used outside of the function.
You can use a server script, just not in the method above. Index the names into a table and reference them through there.
Ex:
--Server Script
--Table to keep them in
local playersInGame = {}
--Insert to table when they join the game
local function onPlayerAdded(player)
playersInGame[player.Name] = player
end
--Remove from table when they leave the game
local function onPlayerRemoved(player)
playersInGame[player.Name] = nil --gets garbage collected
end
Players.PlayerAdded:Connect(onPlayerAdded)
Players.PlayerRemoving:Connect(onPlayerRemoved)