function FindPlayer(userName) for _, Player in ipairs(game.Players:GetPlayers()) do if string.lower(Player.Name) == string.lower(userName) then return Player end end end
I get this error: bad argument #1 to 'lower' (string expected, got Object) Help?
try using tostring(param) for both player.Name and userName to garuntee they are both strings.
function FindPlayer(userName) for _, Player in ipairs(game.Players:GetPlayers()) do if string.lower(tostring(Player.Name)) == string.lower(tostring(userName)) then return Player end end end