I have
elseif m == "/cmds" then PRAW(p,"_/[Administrator Commands]\_") PRAW(p,"/kick [PLAYERNAME]") elseif m:sub(1,6):lower() == "/kick " then if p.UserId == 261477936 then if m:lower() == "/kick" then PRAW(p,"Usage /kick [PLAYERNAME]") elseif m:lower() == "/kick" then PRAW(p,"Usage /kick [PLAYERNAME]") elseif m:sub(7) == "" then PRAW(p,"Usage /kick [PLAYERNAME]") else local PlayerToBeKicked = m:sub(7) for i, l in pairs(game.Players:GetPlayers()) do if m:sub(7) == not l.Name then print("Player Dosen't Exist.") PRAW(p,"Player "..m:sub(7).." Does Not Exist.") elseif l.Name == m:sub(7) then print("Player Exists.") game.Players:WaitForChild(PlayerToBeKicked):Kick("An Administrator Has Kicked You.") end end end end
as a kick code in my custom chat i can kick the player but it dosent respond with player doesnt exist or appear in the messages.
ENTIRE CODE DELETED FOR PRIVACY
Try using FindFirstChild() it detects if it exists Source
elseif m:sub(1,6):lower() == "/kick " then if p.UserId == 261477936 then if m:lower() == "/kick" then PRAW(p,"Usage /kick [PLAYERNAME]") elseif m:lower() == "/kick" then PRAW(p,"Usage /kick [PLAYERNAME]") elseif m:sub(7) == "" then PRAW(p,"Usage /kick [PLAYERNAME]") else local PlayerToBeKicked = m:sub(7) local PlayerPTK = game.Players:FindFirstChild(PlayerToBeKicked) for i, l in pairs(game.Players:GetPlayers()) do if PlayerPTK then print("Player Exists.") game.Players:WaitForChild(PlayerToBeKicked):Kick("An Administrator Has Kicked You.") elseif PlayerPTK == nil then print("The Player "..m:sub(7).." Was Not Found!") PRAW(p, "The Player "..m:sub(7).." Was Not Found!") end end end end
Maybe paste this into line 15 on That (--^) piece of code:
if l == nil then print("No player found in server named "..m:sub(7)) PRAW(p, "Player does not exist in server. Name: "..m:sub(7)) end