I made a part of a function that will kill someone if they do not have the name of the third letter and above of a model. The model in question would be called TB[Name], but this script kills everyone regardless of their name. Here is the script:
local nm = hit.Parent.Parent.Name
local tb = script.Parent.Parent.Name
if nm ~= tb:sub(3) then
hit.Parent.Humanoid:TakeDamage(100)
script.Parent.hit:Play()
wait(1)
end
end
There are no errors in the output. Am I using :sub correctly?

1 comment
It appears you are correct, but now I get this error: Workspace.TBPlayer.shield.shieldscript:8: bad argument #2 to 'sub' (number expected, got no value) (there IS a number in the parenthesis...)