I'm trying to learn string.match and this script looks correct, but it returns nil.
wait()
local player =game.Players.LocalPlayer
local players =game.Players:GetChildren()
function match_name(name)
for i,v in pairs(players) do
local plr=string.match(v.Name,name)
if plr then
return plr
end
end
end
player.Chatted:connect(function(msg)
if string.sub(msg,1,6)=="check~" then
local plr=match_name(string.sub(msg,7))
if plr then
print(plr.Name)
end
end
end)
