当前位置:主页 > 考研教育 > 考研真题
How to make a /kick command

 

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)