I am trying to make a lua script that allows you to ff any player or kill any player, I managed to figure out how to kill players. Using the following code:
local isAdmin {[TomIzBored] = 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)
How could I make another command that will allow me to forcefield a player by saying something like "ff/Player1" then it would force field Player1 or whoever I targeted?

3 comments
The only thing different from the kill command to a force field command is the details; you should be able to do it no problem.
It would be best to connect the chatted event only for the admins then you do not need to check it each time a player sends a msg.
I edited my code so that it works like that now. @kingdom5