So, I'm making an admin script much like Khols, but better. (Once it is done at least it will be) Right now it's at the testing phase and I'm getting the hang of this admin thing. Only problem is there are no errors but it wont kill the player. It was working earlier but then I changed it a lot and now it wont work e.e Anyways here is the script.

--[[						Scriptecx's Ultimate Admin [Testing phase]
	Welcome to my admin! If you get a copy of this you are probably a very special person because
it is in its testing phase at the moment and not near being done. There will be bugs/errors, but be patient 
because I will have all of them fixed as soon as possible.		
]]

--------------------
--   Variables
--------------------
players = game:GetService("Players")


--------------------
--     Settings
--------------------

Settings = {
	----------------------
	-- Admin Settings
	----------------------
	Admins = { "Scriptecx" ; "Player" ; "PreciseLogic"  ; "KyraPromotions" ; "Jorgetheawesomekid" } ;
	Mods = {} ;
	Temps = {} ;
	AllAdmin = true ; -- This will determin if all players get admin or not. 
	------------------------
	--  Group Settings
	------------------------
	GroupOnlyPlace = false ;
	GroupAdmin = true;
	GroupID = 0000 ;  -- This is the ID of your group that you want to have admin. You can find the ID in the link to your group.
	GroupAdminValue = 0000 ;  -- Sets what rank and above a person has to be in the group to have admin. 
	-----------------------
	--   Other settings 
	-----------------------
	Bans = {} ; 
	PunishedList = {}; -- This will be a list of all of the players that have had some sort of punishment placed on them.
	FireSyntax = ":" ;-- This will be what goes in front of the command. EX: ':'Kill Script, '!'Kill Script, ';'Kill Script, '/'Kill Script ect.
}

-- string.find(string.lower(v.Name),string.lower(name))

function findPlayer(name, AdminSpeaking)
	local playerstable = {}
	for _, p in pairs (players:GetPlayers()) do
		if string.find(string.lower(p.Name),string.lower(name)) then 
			table.insert(playerstable, p)
		end
	end
	return playerstable
end
-- Watch for playeradded.
players.PlayerAdded:connect(function(player)
	if Settings.AllAdmin == true then
		player.Chatted:connect(function(command, speaker)
			command = command:lower()
			print ("Player chatted")
			if command:sub (1, 6) ==  Settings.FireSyntax.."kill " then
				print ("Wot")
				local vic = findPlayer(command:sub(7), speaker)
				if vic and vic.Character then vic.Character:BreakJoints() end
				print ("Yas")
			elseif command:sub (1, 9) == Settings.FireSyntax.."respawn " then
				local vic = findPlayer(speaker, command:sub(10))
				if vic and vic.Character then vic:LoadCharacter() end
			elseif command:sub (1, 9) == Settings.FireSyntax.."explode " then
				local vic = findPlayer(command:sub(10), speaker)
				if vic and vic.Character then 
					local explosion = Instance.new("Explosion", vic.Character.Torso) 
					explosion.BlastPressure = 550000 
					explosion.DestroyJointRadiusPercent = 2
					explosion.Position = vic.Character.Torso.Position 
					wait (1)
					explosion:destroy()
				end
			elseif  command:sub (1, 11) == Settings.FireSyntax.."invisible " then
				local vic = findPlayer(command:sub(12), speaker)
				if vic and vic.Character then 
					for i, obj in pairs (vic.Character:GetChildren()) do
						if obj:IsA("BasePart") then obj.Transparency = 1 if obj:findFirstChild("face") then obj.face.Transparency = 1 end elseif obj:IsA("Hat") and obj:findFirstChild("Handle") then obj.Handle.Transparency = 1 end
					end
				end
			elseif  command:sub (1, 9) == Settings.FireSyntax.."visible " then
				local vic = findPlayer(command:sub(10), speaker)
				if vic and vic.Character then
					for i, obj in pairs (vic.Character:GetChildren()) do
						if obj:IsA("BasePart") then obj.Transparency = 0 if obj:findFirstChild("face") then obj.face.Transparency = 0 end elseif obj:IsA("Hat") and obj:findFirstChild("Handle") then obj.Handle.Transparency = 0 end
					end
				end
			end
		end)
	end
end)

2 comments

0

Your problem is line 57; your 'findplayer' function returns a Table; not an Instance/Player.

0

@TheAlphaStigma You mean line 59? Line 57 doesn't have a findplayer.