View difference between Paste ID: J949sD2T and k1EHbdJZ
SHOW: | | - or go back to the newest paste.
1-
local admin = "itsJaden2" --Who is the one who has the admin.
1+
local admin = "Lundo_Fett" --Who is the one who has the admin.
2
3
local Players = Game:GetService("Players") Definding service using a varaiable.
4
Players.PlayerAdded:connect(function(Player)--Event and function when a player has joined.
5
	if Player.Name == Admin then --Checking if the player is the admin.
6
		
7
    Player.Chatted:connect(function(Message)-- Event
8
	    if Message ~= nil then --Checking if the message is not nil with the if statement. (The Message is in nil when teamchat is used.
9
            if string.lower(string.sub(Message,1, 4) == "kick" then --Checking if the kick command is used string.sub is used to get serval characters of the string, this cause the first four. string.lower is used to convert the string to a lowercase string. Saying KICK or Kick instead of kick would work as well.
10
	           local Target = Players:FindFirstChild(string.sub(Message,6)) -- Defending the target using a varbile. stirng.sub is the time used to get all of the characters behind "kick ".
11
	             if Target ~= nil then Checking if the target is found using a if statement.
12
		            Target:Kick() --Removing the target from the game using the: Kick() method on the player object. 
13
		end -- Closing the statement if event at line twevle
14
end) --Closing the statement if event at line nine.	
15
end) --Closing the statement if event at line eight.
16
end) --Closing function and event at line seven.	
17
end) -- Closing the if statement at line six.
18
	end)--Closing function and event at line five.