Output [string "stdin"]:8: 'then' expected near 'return'attempt to call a nil value
I don't understand why my easy script is not working. In other languages I program in, there's no such thing as "then".
local getPlayer = function(playerName)
local players = game.Players:GetPlayers()
for index = 1, #players do
local name = players[index].Name:upper()
if name:find(playerName:upper()) --removed then
return players[index] -- returns player at `index`
end
end
end
