It isn't killing the player. Not sure why....

There are not errors.

Full Script:

--// Ranks
local Owners = {'Player', 'Scriptecx'}
local Admins = {}
local Mods = {}
local Temps = {}
local TempBans = {}
local PBans = {}

--// Configuration Settings
CommandPrefix = 'c'
 NoobAge = 300

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--                                    DONT EDIT ANYTHING UNDER THIS LINE! UNLESS YOU KNOW WHAT YOU ARE DOING!
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

--// Services
local Players = game:GetService('Players')
local Lighting = game:GetService('Lighting')
local Debris = game:GetService('Debris')

function GetPlayers() return Players:GetPlayers() end

function CheckRank(player,rank)
	for _,v in pairs (rank) do 
		if tonumber(v) and v == player.userId then
			print ('User Accepted')
			return true 
		elseif tostring(v) and v == player.Name:lower() then 
			print ('User Accepted')
			return true
		else print ('Nop')
		end
	end
	return false 
end

function getPlayer (msg, speaker)
	local Got = {}
	if msg:sub(1,2) == "me" then return {speaker}
	elseif msg:sub(1,3) == "all" then 
		for _, v in pairs (GetPlayers()) do 
			table.insert (Got, v) 
		end
	elseif msg:sub(1,6) == "others" then 
		for _,v in pairs (GetPlayers()) do 
			if v ~= speaker then table.insert (Got, v) 
			end 
		end		
	elseif msg:sub (1,6) == "random" then 
		return {(Players[math.random (1, #Players:GetPlayers())])}
	elseif msg:sub(1,6) == "admins" then 
		for _,v in pairs (GetPlayers()) do 
			if CheckRank(v, Admins) == true or CheckRank(v, Temps) == true or CheckRank(v, Owners) == true or CheckRank(v, Mods) == true then 
				table.insert(Got, v) 
			end 
		end
	elseif msg:sub(1,6) == "nonadmins" then 
		for _,v in pairs (GetPlayers()) do 
			if CheckRank(v, Admins) == false or CheckRank(v, Temps) == false or CheckRank(v, Owners) == false or CheckRank(v, Mods) == false then table.insert(Got, v) 
			end 
		end
	elseif msg:sub(1,5) == "noobs" then  
		for _,v in pairs (GetPlayers()) do 
			if v.AccountAge <= NoobAge then 
				table.insert(Got, v) 
			end
		end
	elseif msg:sub(1,6) == "elders" then  
		for _,v in pairs (GetPlayers()) do 
			if v.AccountAge >= NoobAge then 
				table.insert(Got, v) 
			end 
		end
	else 
		for _, v in pairs (GetPlayers()) do 
			if string.find(string.lower(v.Name),string.lower(msg)) then 
				return {v} 
			end 
		end
	end	
	return Got
end

function chat(str, Speaker)
	local command = str:lower()
	if CheckRank(Speaker,Owners) then
		if command:sub (1, 4 + CommandPrefix:len()) == CommandPrefix.."kill" then
			local player = getPlayer(command:sub(4 + #CommandPrefix + 1), Speaker)
			if #player >= 1 then
				for _, p in pairs (player) do player.Character:BreakJoints() end
			end
		end
	end
end

Players.PlayerAdded:connect(function(plr)
	plr.Chatted:connect(function(str)
		chat(str, plr)
	end)
end)

4 comments

0

You aren't giving it a player. That's why.

0

I just added the full script. Look at it.

0

I just did like 5 mins ago.

1

On line 62, you are calling chat function without passing player as second argument. Change 'plr.Chatted:connect(chat)' to 'plr.Chatter:connect(function(str) chat(str,plr) end)'