return function(I)local R=I.Color local C=service.PlayerGui local y=service.Players.LocalPlayer local q=y:GetMouse()local k=script.Parent.Parent if R=="\111\102\102"then local I=client.UI.Get("\066\067\104\097\116")if I then for I,R in pairs(I)do if R~=k then R:Destroy()end end k:Destroy()end else if C:FindFirstChild(k.Name)then C[k.Name]:Destroy()end local I=k.Frame.Box local l=k.Frame.Close I.Text="\067\108\105\099\107 \104\101\114\101 \111\114 \112\114\101\115\115 \"\059\" \116\111 \099\104\097\116"I.FocusLost:connect(function(C)if C and(y.Character:FindFirstChild("\072\101\097\100")and(R and I.Text~="\067\108\105\099\107 \104\101\114\101 \111\114 \112\114\101\115\115 \"\059\" \116\111 \099\104\097\116"))then service.ChatService:Chat(y.Character.Head,service.LaxFilter(I.Text),R)I.Text="\067\108\105\099\107 \104\101\114\101 \111\114 \112\114\101\115\115 \"\059\" \116\111 \099\104\097\116"end end)q.KeyDown:connect(function(R)if R=="\059"then I:CaptureFocus()end end)l.MouseButton1Click:connect(function()k:Destroy()end)gTable:Ready()end end


return function(data)
	local color = data.Color
	local playergui = service.PlayerGui
	local localplayer = service.Players.LocalPlayer
	local mouse = localplayer:GetMouse()
	local gui = script.Parent.Parent
	
	if color=='off' then
		local guis = client.UI.Get("BChat")
		if guis then
			for i,v in pairs(guis) do
				if v ~= gui then
					v:Destroy()
				end
			end
			gui:Destroy()
		end
	else
		if playergui:FindFirstChild(gui.Name) then 
			playergui[gui.Name]:Destroy() 
		end
		
		local box = gui.Frame.Box
		local close = gui.Frame.Close
		
		box.Text='Click here or press ";" to chat'
		
		box.FocusLost:connect(function(enterPressed)
			if enterPressed and localplayer.Character:FindFirstChild('Head') and color and box.Text~='Click here or press ";" to chat' then
				service.ChatService:Chat(localplayer.Character.Head,service.LaxFilter(box.Text),color)
				box.Text='Click here or press ";" to chat'
			end
		end)
		
		mouse.KeyDown:connect(function(key)
			if key==';' then
				box:CaptureFocus()
			end
		end)
		
		close.MouseButton1Click:connect(function()
			gui:Destroy()
		end)
		
		gTable:Ready()
	end
end
