I have made an admin command where you can enable a force field on someone. The admin command is not working, and I tried to print the force field's parent, but it did not print anything in the output.
if Chat:lower():sub(1, #Prefix + #"ff") == Prefix.."ff" then
for i, v in pairs(game.Players:GetPlayers()) do
if string.match(string.sub(Chat, 7), v.Name) then
local ff = Instance.new("ForceField", plr.Character)
print(ff.Parent)
end
end
end
How would I make it so it inserts a force field into the target?

3 comments
Why not try using string.gmatch()?
^ GMatch is an iterator function that returns the pattern when found. https://developer.roblox.com/articles/Lua-Libraries/string#gmatch
I fixed the indentation, and removed the extra ends.