Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Define the command prefix for admin commands
- local commandPrefix = "!"
- -- Function to handle player chat
- local function onPlayerChat(player, message)
- -- Check if the player is an admin (you can define your own admin check logic)
- local isAdmin = player:IsInGroup(YOUR_ADMIN_GROUP_ID) -- Replace with your group ID or custom admin check
- -- Check if the message starts with the command prefix and the player is an admin
- if isAdmin and string.sub(message, 1, #commandPrefix) == commandPrefix then
- -- Get the command without the prefix
- local command = string.sub(message, #commandPrefix + 1)
- -- Process admin commands
- if command == "kick" then
- -- Implement your kick logic here
- -- Example: game.Players:FindFirstChild(targetPlayerName):Kick("You have been kicked by an admin.")
- elseif command == "ban" then
- -- Implement your ban logic here
- -- Example: game.Players:FindFirstChild(targetPlayerName):Kick("You have been banned by an admin.")
- -- Add more admin commands as needed
- end
- end
- end
- -- Connect the onPlayerChat function to the PlayerChatted event
- game.Players.PlayerAdded:Connect(function(player)
- player.Chatted:Connect(function(message)
- onPlayerChat(player, message)
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement