Players.Comqts.PlayerGui.ScreenGui.LocalScript:12: invalid argument #1 to 'pairs' (table expected, got string)

I previously had a different issue solved; and the script that the individual gave me was working fine until I tried to execute another command.

I’m currently making an admin system for a game, and I’m trying to use the notification system in it.

This is what I’m currently getting when I type in the command without a valid player

image

This is what I would like
image

STARTER_GUI_LOCAL_SCRIPT

game.ReplicatedStorage.Notification.OnClientEvent:Connect(function(Type, CommandsList)
	local startergui = game:GetService("StarterGui")
	local text = ""
	if Type == "COMMANDS" then
		for _, command in pairs(CommandsList) do
			text = text .. "\n"..command
		end
	end

	startergui:SetCore("SendNotification", {
		Title = "NOTIFICATION",
		Text = text
	})
end)

SSS_GAMEBAN_SCRIPT

elseif string.sub(Message, 1 ,8) == "/gameban" and table.find(permissions.gameban, AdminLevel) then 
			
			local Target = game.Players:FindFirstChild(string.sub(Message,10,string.len(Message)-string.len(string.sub(Message,10))-1))
			
			
			if Target ~= nil then
				
				game:GetService("DataStoreService"):GetOrderedDataStore("PermBan"):SetAsync(Target.UserId.."_GameBanned")
				
				Player:Kick("You have been banned from the game.")
				
			else
				
				game.ReplicatedStorage.Notification:FireClient(Client, "COMMANDS", "Player is Invalid")
				
			end;	
game.ReplicatedStorage.Notification.OnClientEvent:Connect(function(Type, CommandsList)
	local startergui = game:GetService("StarterGui")
	local text = ""
	if Type == "COMMANDS" then
if typeof(CommandsList) == "string" then
      text = CommandsList
    else
		for _, command in pairs(CommandsList) do
			text = text .. "\n"..command
		end
      end
	end

	startergui:SetCore("SendNotification", {
		Title = "NOTIFICATION",
		Text = text
	})
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.