I am making an admin script for my game.
It is working fine, but I want to remove the need of typing the target player's full name. I want it so we only need to type like half of the name or less, and case insensitive.
Here is the script:
local admins = {"StrategicPlayZ", "1_7z", "Player1"}
local onPlayerAdded = function(player)
for _, name in pairs(admins) do
if player.Name == name then
player.Chatted:Connect(function(msg)
if string.sub(msg, 1, 5) == "kill/" and game.Players:FindFirstChild(string.sub(msg, 6)) then
game.Players:FindFirstChild(string.sub(msg, 6)).Character:BreakJoints()
end
end)
end
end
end
game.Players.PlayerAdded:Connect(onPlayerAdded)
Please explain me how I can do this. I don't want to just copy paste the script.
Thanks in advance!

1 comment
look at the answers on this question https://scriptinghelpers.org/questions/74206/find-player-from-part-of-their-name#69980