Im trying to teleport a player to a part, and when I say "/r .. players name here" it will teleport a random player, and not the player I was looking for. I'm using string.match, and it keeps teleporting random players. I think it is because string.match only matches 1 letter, idk. Help pls ty <3 (no homo)
game.Players.PlayerAdded:Connect(function(player)
local source = string.upper(player.Name)
if Check(source) == true then
player.Chatted:Connect(function(msg)
if string.match(string.lower(msg), command) then
local Players = game.Players:GetPlayers()
for i = 1, #Players do
local strFind = string.find(string.lower(msg), command)
local plrName = strFind + 2 or strFind + 1
if strFind then
if string.match(string.sub(string.lower(msg), plrName), string.sub(string.lower(Players[i].Name), 1, string.len(plrName))) then
TeleportPlayer(Players[i].Name)
return true
end
end
end
end
end)
end
end)
