So I'm gonna script a gui with a textbox, what I plan on doing is having it kill the target in the box, I'm new to this type of scripting, I've been looking at this script from the wiki trying to figure out what each part means, what I'm asking is if someone can define what it does when finding the target player, etc. Thank you for taking the time to read or help. I'm not asking for a script to do what I'm trying to do btw, just asking to help define. (Lines 2-18) I have a basic understanding of scripting.
local isAdmin = {["DontBlinkDrWho"] = true, ["Admin1"] = true, ["Admin2"] = true}
function findPlayer(name)
for _, player in ipairs(game.Players:GetPlayers()) do
if player.Name:lower() == name:lower() then
return player
end
end
end
function onChatted(message, player)
if message:sub(1, 5) == "kill/" and isAdmin[player.Name] then
victim = findPlayer(message:sub(6))
if victim and victim.Character then
victim.Character:BreakJoints()
end
end
end
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(message) onChatted(message, player) end)
end)

1 comment
so you're trying to make an admin gui button where you type a name and it kills the person?