The following code always returns nil which is there error(there is more into the script but this is what I need to be fixed)
function SearchPlr(text)
for i, v in next,game.Players:GetPlayers() do
if string.find(v.Name,"^"..text) then
return v.Name:lower()
end
end
end
No matter what I do v:lower() or v.Name:lower() it always returns nil =/

2 comments
Wouldn't I use: if v.Name:sub(1, string.len(text)):lower() == text:lower() then -- string.len() because text isn't a table.
works on both strings and tables to mean their length. It's much briefer, and I believe less expensive, so I prefer it.