So recently I have been creating a Admin Panel GUI and I am currently working on a kick function. Sadly, whenever I kick the player, I only get the first word of the third argument, and not the rest, I am wondering how I get the rest of the argument? Any help is appreciated and thanks in advance!
Here is my code:
The kick function is at the bottom
local manualbanned = {"NACKRR"}
local admins = {"NACKRR"}
local prefix = ";"
local dss = game:GetService("DataStoreService")
local bds = dss:GetDataStore("BanDataStore")
function checkadmin(name)
for i,v in pairs(admins) do
if v == name then return true
else
return false
end
end
end
function setoutput(plr,text)
plr.PlayerGui.AdminPanel.CommandBackground.Output.Text = tostring(text)
wait(5)
plr.PlayerGui.AdminPanel.CommandBackground.Output.Text = ""
end
game.Players.PlayerAdded:Connect(function(player)
local userid = player.UserId
local banned
if manualbanned[userid] then
player:Kick("You have been banned by a Developer")
end
local success, errormessage = pcall(function()
local playeruserid = player.UserId
banned = bds:GetAsync(playeruserid)
end)
if banned then
player:Kick("You have been banned by an Administrator")
end
end)
function execCommand(cmd, plr)
--// Kill Function \\--
local args = cmd:split(" ")
if args[1] == prefix.."kill" then
if game.Players:FindFirstChild(args[2]) then
game.Players:FindFirstChild(args[2]).Character.Humanoid.Health = 0
else
setoutput(plr, "Player Not Found, "..tostring(args[2]))
end
--// Speed Function \\--
elseif args[1] == prefix.."speed" then
if game.Players:FindFirstChild(args[2]) then
if args[3] then
game.Players:FindFirstChild(args[2]).Character.Humanoid.Speed = tonumber(args[3])
else
setoutput(plr, "Invalid Argument, "..tostring(args[3]))
end
else
setoutput(plr, "Player Not Found, "..tostring(args[2]))
end
--// Jump Function \\--
elseif args[1] == prefix.."jump" then
if game.Players:FindFirstChild(args[2]) then
if args[3] then
game.Players:FindFirstChild(args[2]).Character.Humanoid.JumpPower = tonumber(args[3])
else
setoutput(plr, "Invalid Argument, "..tostring(args[3]))
end
else
setoutput(plr, "Player Not Found, "..tostring(args[2]))
end
--// Bring Function \\--
elseif args[1] == prefix.."bring" then
if game.Players:FindFirstChild(args[2]) then
game.Players:FindFirstChild(args[2]).Character.HumanoidRootPart.CFrame = plr.Character.HumanoidRootPart.CFrame + Vector3.new(0, 2, 0)
else
setoutput(plr, "Player Not Found, "..tostring(args[2]))
end
--// Goto Function \\--
elseif args[1] == prefix.."goto" then
if game.Players:FindFirstChild(args[2]) then
plr.Character.HumanoidRootPart.CFrame = game.Players:FindFirstChild(args[2]).Character.HumanoidRootPart.CFrame + Vector3.new(0, 2, 0)
else
setoutput(plr, "Player Not Found, "..tostring(args[2]))
end
--// Jail Function \\--
elseif args[1] == prefix.."jail" then
if game.Players:FindFirstChild(args[2]) then
game.Players:FindFirstChild(args[2]).Character.HumanoidRootPart.CFrame = game.Workspace.JailTeleport.CFrame
else
setoutput(plr, "Player Not Found, "..tostring(args[2]))
end
--// Unjail Function \\--
elseif args[1] == prefix.."unjail" then
if game.Players:FindFirstChild(args[2]) then
game.Players:FindFirstChild(args[2]).Character.HumanoidRootPart.CFrame = game.Workspace.UnjailTeleport.CFrame
else
setoutput(plr, "Player Not Found, "..tostring(args[2]))
end
--// Kick Function \\--
elseif args[1] == prefix.."kick" then
if game.Players:FindFirstChild(args[2]) then
game.Players:FindFirstChild(args[2]):Kick("An Administrator has kicked you for the for the following "..tostring(args[3]))
end
end
end