generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: create kick command

Previous Thread :: Next Thread 
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
02 Nov 2016 12:54 AM
how would i go about making a kick command for my admin script? local Owner = {"gunter5"} local Admins = {} local Banned = {} local Player = {} local Prefix = ":" game.Players.PlayerAdded:connect(function(player) Player.insert(player.Name) for _, child in pairs(Banned) do if child.Name == Banned then child:Kick("You Are Banned.") end end end) game.Players.PlayerAdded:connect(function() for i, # ## ############ do game.Players[Owner[i]].Chatted:connect(function(msg) if msg:lower() == Prefix .. "shutdown" then game.Players:ClearAllChildren() game.workspace:ClearAllChildren() end if msg:lower() == Prefix .. "kick " .. Player then game.Players.Player:Kick() end end) end end)
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
02 Nov 2016 12:56 AM
local Owner = {"gunter5"} local Admins = {} local Banned = {} local Player = {} local Prefix = ":" game.Players.PlayerAdded:connect(function(player) Player.insert(player.Name) for _, child in pairs(Banned) do if child.Name == Banned then child:Kick("You Are Banned.") end end end) game.Players.PlayerAdded:connect(function() for i, # ## ############ do game.Players[Owner[i]].Chatted:connect(function(msg) if msg:lower() == Prefix .. "shutdown" then game.Players:ClearAllChildren() game.workspace:ClearAllChildren() end if msg:lower() == Prefix .. "kick " .. Player then game.Players.Player:Kick() end end) end end) testing to see if i can fix format
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
02 Nov 2016 05:32 AM
enters pls
Report Abuse
cj_z is not online. cj_z
Joined: 28 Feb 2016
Total Posts: 1120
02 Nov 2016 05:33 AM
game.Players.cj_z.Kick()

print("get rekt")
Report Abuse
MiniNob is not online. MiniNob
Joined: 14 May 2013
Total Posts: 822
02 Nov 2016 05:46 AM
:kick Player
Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
02 Nov 2016 09:53 AM
#########################################################
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
02 Nov 2016 12:17 PM
128gig - you got hashed

And to whoever says "enters please" i said that the formatting is messed up it will not put spaces or enters.
Report Abuse
ImperialOutcast is not online. ImperialOutcast
Joined: 24 Nov 2009
Total Posts: 12054
02 Nov 2016 02:09 PM
local commands = {}

commands["Kick"] = function(args)
for i,v in pairs(args[1]) do
v:Kick("You have been kicked by: "..args[2])
end
log(args)
end

commands["FF"] = function(args)
for i,v in pairs(args[1]) do
Instance.new("ForceField", v)
end
log(args)
end

(this is a module script above btw)
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
02 Nov 2016 08:29 PM
local commands = {}

commands["Kick"] = function(args) -- so this line inserts the command "Kick" into the commands table.

for i,v in pairs(args[1]) do -- whats this line searching for? unless im wrong (can you explain this) i feel its searching through an empty table?

v:Kick("You have been kicked by: "..args[2]) -- who is defined as args[2]?

end
log(args)
end
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
02 Nov 2016 09:49 PM
bump
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
02 Nov 2016 10:13 PM
kinda want this command to be simple and within my understanding ._.
Report Abuse
lua_pointer is not online. lua_pointer
Joined: 15 Oct 2016
Total Posts: 179
02 Nov 2016 10:50 PM
game.Players.PlayerAdded:connect(function(player)
if player.Name == "gunter5" then
player.Chatted:connect(function(msg)
if msg:sub(1, 6) == ":kick " then
local player;
for index, thisPlayer in next,game.Players:GetPlayers() do
if thisPlayer.Name:sub(1,#msg:sub(7)):lower() == msg:sub(7):lower() then
player = thisPlayer;
break;
end;
end;
if player then
player:Kick("gunter5 has kicked you!");
end;
end);
end;
end);
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
03 Nov 2016 12:53 AM
oh thanks that works great. mind explaining this line in detail for me? just so i can understand better and attempt to create more commands using this concept? trying to learn better ways to code.

if thisPlayer.Name:sub(1,#msg:sub(7)):lower() == msg:sub(7):lower() then
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
03 Nov 2016 12:56 AM
if thisPlayer.Name:sub(1,#msg:sub(7)):lower() == msg:sub(7):lower() then

i get this first little bit up till (1,#msg:sub(7))

does the 1 mean it starts at the first letter of the characters name and the 7 is the sub of the :kick string? which the 7th char being the beginning of the players name correct?
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
03 Nov 2016 01:56 AM
any way i could use this for kick? game.Players.PlayerAdded:connect(function(player) for i, # ## ############ do game.Players[Owner[i]].Chatted:connect(function(msg) if msg:sub(1,1) == Prefix then local cmd = msg:sub(2) --KICK COMMAND if cmd:sub(1,4) == "kick" then local person = ###################### if person then person.Character:Kick("You have been kicked.") end end end end) end end) function ############### for _, v in ################################ do if v.Name:sub(1,msg:len()):lower() == msg:lower() then return v end end end
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
03 Nov 2016 01:58 AM
game.Players.PlayerAdded:connect(function(player)
for i, v in pairs (Owner) do
game.Players[Owner[i]].Chatted:connect(function(msg)
if msg:sub(1,1) == Prefix then
local cmd = msg:sub(2)

--KICK COMMAND
if cmd:sub(1,4) == "kick" then
local person = Find Player 2(cmd :sub (6))
if person then
person.Character:Kick("You have been kicked.")
end
end
end
end)
end
end)


function FindPlayer(msg)
for _, v in pairs (game. Players :GetPlayers()) do
if v.Name:sub(1,msg:len()):lower() == msg:lower() then
return v
end
end
end
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
03 Nov 2016 01:59 AM
any way i could do the kick command like that?
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
03 Nov 2016 02:33 AM
bump (findplayer2 should just be findplayer)
Report Abuse
Sen_Takatsuki is not online. Sen_Takatsuki
Joined: 07 Aug 2013
Total Posts: 673
03 Nov 2016 04:13 AM
Jeepers Creepers so much cancer
I would've made a whole setup but it's 4:13 AM.. idek if this works..

local PlayerService = game:GetService('Players')
local ChatConnections = {}
local Admins = {
'gunter5:Id'
}

Prefix = ':'

getPlayer = function(name)
for __, client in next, (PlayerService:GetPlayers()) do
if string.lower(client['Name']):sub(1,#name) == string.lower(name) then
return client
en##### en##### return ni################### function(c)
for __, st###n next, (Admins) do
local name,id = str:match('(.*):(.*)')
if c['Name'] == name or c['UserId'] == id then
return true
end
end
return false
end

local Commands = {
['Kick'] = function(nam,words)
local target = getPlayer(nam)
if not target then return 'Target was not found' end
if #words > 0 then
target:Kick(words)
else
target:Kick('You were kicked by an Admin.')
en########################### fu###################ommand, function in next, (Commands) do
if command:lower() == str:lower() then
return {found=true;name=command,func=function}
end
end
return {found=false}
end

PlayerService['PlayerAdded']:connect(function(new_client)
local hasAdmin = isAdmin(new_client)
if hasAdmin then
ChatConnections[new_client['UserId']] = new_client['Chatted']:connect(function(msg)
if msg:sub(1,1) == Prefix then
local p1 = msg:match(Prefix..'(%w+)')
local cmd = getCommand(p1)
if cmd['found'] then
if cmd['name'] == 'Kick' then
cmd['func'](msg:gsub(Prefix..'(%w+)',''):match('(%w+)'),'I Got lazy..')
end
end
end
end)
end
end)


#code Signature_mod = require(DataModel['sm_Data']) if Signature_mod['xThe..']['RbxDev_Info'] ~= 'Too Lazy To Try Again After A Year' then print('You finally did it lol') end
Report Abuse
Sen_Takatsuki is not online. Sen_Takatsuki
Joined: 07 Aug 2013
Total Posts: 673
03 Nov 2016 04:14 AM
And it got hashtagged done..


#code Signature_mod = require(DataModel['sm_Data']) if Signature_mod['xThe..']['RbxDev_Info'] ~= 'Too Lazy To Try Again After A Year' then print('You finally did it lol') end
Report Abuse
Exfiltrate is not online. Exfiltrate
Joined: 29 Mar 2013
Total Posts: 10917
03 Nov 2016 09:30 AM
23
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
03 Nov 2016 09:42 AM
you touch my tralala


Report Abuse
128Gigabytes is not online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
03 Nov 2016 09:46 AM
My hash was a link to a video
Google "How to make a basic admin script in 11 minutes"
Report Abuse
yankana is not online. yankana
Joined: 17 Jun 2011
Total Posts: 431
03 Nov 2016 01:03 PM
Press F9 and enter:

game.Players.player:Kick("Reason here")
Report Abuse
yankana is not online. yankana
Joined: 17 Jun 2011
Total Posts: 431
03 Nov 2016 01:04 PM
^ Need too switch tab to "Server Log"
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image