How to make a /kick command

Hey there,

I just wanted to know, how would I be able to make a /kick command?
I mean, I could literally just use the console but that’s boring

This is my script:

	if player:GetRankInGroup(8423759) == 7  then
		player.Chatted:Connect(function(msg)
			if msg.match("/e kick") then
				local plrToKickName = msg:split(' ')[2]
				local plrToKick = Players:FindFirstChild(plrToKickName)
				if plrToKick then
					player:Kick("You have been kicked from Eternity 2000!")

Please help!

*(If you are wondering why it’s ‘Eternity 2000’ it’s because our game. Take a look if you want: Eternity 2000 - Roblox)

If the script isn’t working then thats because it only works for people that have a group role rank of 7, since you own the group, your group role would be 255, so to fix that you should use a >= instead of ==.

So this:

Would be:
if player:GetRankInGroup(8423759) >= 7 then

If the script still doesn’t work then PLEASE show any errors the script has.

1 Like

Thanks! I will be testing this ASAP!

Also ignore the script, its outdated

local cmds = {
    ["/kick"] = function(args) -- CMD USAGE: "/kick user reason"
        local plr = args[2]
        table.remove(args, 1)
        table.remove(args, 2)
        local reason = table.concat(args, " ")
        for _, v in next, game.Players:GetPlayers() do
            if string.lower(v.Name) == string.lower(plr) then
                v:Kick("You have been kicked from this game.. You can rejoin")
            end
        end
    end,
}

game.Players.PlayerAdded:Connect(function(player)
    if player:GetRankInGroup(8423759) >= 7 then
        player.Chatted:Connect(function(msg)
            local args = string.split(msg, " ")
            cmds[string.lower(args[1])](args)
        end)
    end
end)
1 Like

Thank you, it works, but can I talk to you in the PMs?

Sure

1 Like