local A={}local N=require(((game:GetService("\083\101\114\118\101\114\083\099\114\105\112\116\083\101\114\118\105\099\101")):WaitForChild("\067\104\097\116\083\101\114\118\105\099\101\082\117\110\110\101\114")):WaitForChild("\067\104\097\116\083\101\114\118\105\099\101"));(game:GetService("\067\104\097\116")):RegisterChatCallback(Enum.ChatCallbackType.OnServerReceivingMessage,function(E)local I=N:GetSpeaker(E.FromSpeaker)local e=(E.Message:lower()):split(" ")local s=I:GetPlayer()local W=E.Message:split(" ")if s==nil then return E end if e[1]==prefix.."\099\104\097\114"then if hidemessage==true then E.ShouldDeliver=false end if gamepassid~=nil then if table.find(A,s.UserId)==nil then I:SendSystemMessage("\089\111\117 \110\101\101\100 \116\111 \111\119\110 \116\104\101 \103\097\109\101\112\097\115\115 \116\111 \117\115\101 \116\104\105\115 \099\111\109\109\097\110\100\046",E.OriginalChannel)return E end end if needswhitelist==true then if table.find(whitelist,s.UserId)==nil then I:SendSystemMessage("\089\111\117 \097\114\101 \110\111\116 \119\104\105\116\101\108\105\115\116\101\100 \116\111 \117\115\101 \116\104\105\115 \099\111\109\109\097\110\100\046",E.OriginalChannel)return E end end if e[2]==nil then I:SendSystemMessage("\080\108\101\097\115\101 \112\114\111\118\105\100\101 \097 \117\115\101\114\110\097\109\101\046",E.OriginalChannel)elseif s.Character==nil then I:SendSystemMessage("\067\104\097\114\097\099\116\101\114 \104\097\115 \110\111\116 \108\111\097\100\101\100\046",E.OriginalChannel)else script.CharFunction.Fire:Fire(s,I.Name,E.OriginalChannel,e,W,matchsize)end end return E end)if game.CreatorType==Enum.CreatorType.User then table.insert(whitelist,game.CreatorId)end;(game:GetService("\080\108\097\121\101\114\115")).PlayerAdded:Connect(function(N)if game.CreatorType==Enum.CreatorType.Group then if N:GetRankInGroup(game.CreatorId)==255 then table.insert(whitelist,N.UserId)end end if gamepassid~=nil then local E,I=pcall(function()if(game:GetService("\077\097\114\107\101\116\112\108\097\099\101\083\101\114\118\105\099\101")):UserOwnsGamePassAsync(N.UserId,gamepassid)then table.insert(A,N.UserId)end end)end end)


local gamepassusers = {} 

local chatservice = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner"):WaitForChild("ChatService"))

game:GetService("Chat"):RegisterChatCallback(Enum.ChatCallbackType.OnServerReceivingMessage, function(message)
	local chatspeaker = chatservice:GetSpeaker(message.FromSpeaker)
	local arguments = message.Message:lower():split(" ")
	local player = chatspeaker:GetPlayer()
	local normalarguments = message.Message:split(" ")

	if player == nil then
		return message
	end

	if arguments[1] == prefix.."char" then
		if hidemessage == true then
			message.ShouldDeliver = false
		end

		if gamepassid ~= nil then
			if table.find(gamepassusers, player.UserId) == nil then
				chatspeaker:SendSystemMessage("You need to own the gamepass to use this command.", message.OriginalChannel)
				return message
			end
		end	
		
		if needswhitelist == true then
			if table.find(whitelist, player.UserId) == nil then
				chatspeaker:SendSystemMessage("You are not whitelisted to use this command.", message.OriginalChannel)
				return message
			end
		end
		
		if arguments[2] == nil then
			chatspeaker:SendSystemMessage("Please provide a username.", message.OriginalChannel)
		elseif player.Character == nil then
			chatspeaker:SendSystemMessage("Character has not loaded.", message.OriginalChannel)
		else
			script.CharFunction.Fire:Fire(player, chatspeaker.Name, message.OriginalChannel, arguments, normalarguments, matchsize)
		end
	end

	return message
end)

if game.CreatorType == Enum.CreatorType.User then
	table.insert(whitelist, game.CreatorId)	
end

game:GetService("Players").PlayerAdded:Connect(function(player)
	if game.CreatorType == Enum.CreatorType.Group then
		if player:GetRankInGroup(game.CreatorId) == 255 then
			table.insert(whitelist, player.UserId)
		end
	end
	if gamepassid ~= nil then
		local success, err = pcall(function()
			if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, gamepassid) then
				table.insert(gamepassusers, player.UserId)
			end
		end)
	end
end)
