Help Making Kick Command (solved)

How can i make a kick command when i say something specific?
I have not come up with a way to no matter how hard I think or research
Variables:

local Owner = {"SpaceMan_Mars"}
local PreFix = "NEBconsole/"

I already have the identifying if its me or not down i just need a way to kick a specific player by typing their name in after saying Nebconsole/Kick “Player”

I think the documentation’s tutorial should help you understand:

You have to use textchatservice for this by the way.

local TextChatService = game:GetService("TextChatService")
local Players = game:GetService("Players")

TextChatService.OnIncomingMessage = function(message: TextChatMessage)
	local properties = Instance.new("TextChatMessageProperties")

	if message.TextSource then
		local player = Players:GetPlayerByUserId(message.TextSource.UserId)
		if player.Name = "SpaceMan_Mars" then
			properties.PrefixText = "<font color='#F5CD30'>[VIP]</font> " .. message.PrefixText
		end
	end

	return properties
end

This is just some example code but I think you could modify it to your liking.

This isnt what im looking for though
What im trying to make is a system where i can type in
"NEBconsole/Kick (“Player”) player as in the player i want to kick

heres a function that can tokenize a string

local function tokenize(inputstr, separator)

	local args = {}
	for str in string.gmatch(inputstr, "([^".. separator .."]+)") do
		table.insert(args, str)
	end

	return args

end

you can use it to make a command like this

local testCommand = "/kick bob"

local tokenized = tokenize(testCommand, " ")

if tokenized[1] == "/kick" then 
  print("going to kick", tokenized[2]) -- prints "going to kick bob"
end

if you want to get chat logs then use plr.Chatted
or if you want a console then make a textbox and use a remote event to send the text to the server

how can i implement this into this script?

local Owner = {"SpaceMan_Mars"}
local PreFix = "NEBconsole/"	

game.Players.PlayerAdded:Connect(function(Player)
	for _,v in pairs(Owner) do
		if Player.Name == v then
			Player.Chatted:Connect(function(PlayerChatted)

PlayerChatted is the message that the player chatted

you should make a dictionary with all the commands and their execute functions and then compare them to the message in a loop

1 Like

Research before posting:

You can also watch this:

And here is the documentation on Player:Kick()

And if you want I made a kick Gui you can use

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.