I am making a loop kill admin command

I am trying to make a loop kill admin command and so I have already written the code which automatically loops through a table of all the different players to loop kill them upon spawning and that works fine but the actual admin command bit isn’t working and can’t find the player.

elseif msg:lower():sub(1,9) == prefix.."loopkill" then --Loopkill command
		local player = game.Players:FindFirstChild(msg:sub(11))
		table.insert(loopkillPlayers, player.Name)
end

Is there something I’m doing wrong?

(Please note the indentation is fine in the script it just looks a bit messy and out of place here).

print the player’s name and see if there is any spaces in it

I did try printing and nothing came up, no error, nothing.

I’m pretty sure this part is wrong

 game.Players:FindFirstChild(msg:sub(11))

You have to start at 10 (as after the loopkill there is a space) and end at the end of the string I guess.

1 Like

The format works for my other admin commands but just not for loop kill.

1 Like

I found the mistake, thanks for your help.

1 Like

Mark the post as solved please.