if FakeChatStorage and(FakeChatStorage.UI and FakeChatStorage.Connections)then FakeChatStorage.UI:Destroy()for y,K in next,FakeChatStorage.Connections do K:Disconnect()end end;(getgenv()).FakeChatStorage={Connections={};UI=nil}local y=syn and syn.set_thread_identity or set_thread_identity or setidentity or setthreadidentity local K=syn and syn.get_thread_identity or get_thread_identity or getidentity or getthreadidentity local s=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local I=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local V=game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")local G=game:GetService("\067\104\097\116")local b=game:GetService("\067\111\114\101\071\117\105")local R=game:GetService("\080\108\097\121\101\114\115")local m=game:GetService("\082\117\110\083\101\114\118\105\099\101")if not R.LocalPlayer then(R:GetPropertyChangedSignal("\076\111\099\097\108\080\108\097\121\101\114")):Wait()end local r=R.LocalPlayer local U=FakeChatStorage.Connections local M={}U.OnJoin=R.PlayerAdded:Connect(function(y)M[y]=y end)U.OnLeave=R.PlayerRemoving:Connect(function(y)M[y]=nil end)for y,K in next,R:GetPlayers()do M[K]=K end local function Y(y,K,s)local I=Instance.new(y)for y,K in next,K or{}do I[y]=K for y,K in next,s or{}do K.Parent=I end end return I end local Z={Color3.new(.9921568627451,.16078431372549,.26274509803922),Color3.new(.003921568627451,.63529411764706,1.0),Color3.new(.007843137254902,.72156862745098,.34117647058824),(BrickColor.new("\066\114\105\103\104\116 \118\105\111\108\101\116")).Color,(BrickColor.new("\066\114\105\103\104\116 \111\114\097\110\103\101")).Color;(BrickColor.new("\066\114\105\103\104\116 \121\101\108\108\111\119")).Color,(BrickColor.new("\076\105\103\104\116 \114\101\100\100\105\115\104 \118\105\111\108\101\116")).Color,(BrickColor.new("\066\114\105\099\107 \121\101\108\108\111\119")).Color}local function h(y)local K=0 for s=1,#y,1 do local I=string.byte(string.sub(y,s,s))local V=(#y-s)+1 if#y%2==1 then V=V-1 end if V%4>=2 then I=-I end K=K+I end return K end local function c(y)return Z[h(y)%#Z+1]end local function S(y,K,s)local I=y.Name local V={ID=math.random();FromSpeaker=y.DisplayName;SpeakerUserId=y.UserId;OriginalChannel=s and"\070\114\111\109 "..I or"\065\108\108",IsFiltered=true,MessageLength=string.len(K),Message=K;MessageType="\077\101\115\115\097\103\101";Time=os.time()+10,ExtraData=y.Team and y.Team.TeamColor.Color or{NameColor=c(I)}}if y and(y.Character and y.Character:FindFirstChild("\072\101\097\100"))then G:Chat(y.Character:FindFirstChild("\072\101\097\100"),K,0)end return V end local E={me=function()return{r}end,others=function()local y=M y[r]=nil return y end,all=function()return M end}local function j(y)local K={}if E[y:lower()]then return E[y:lower()]()end for s,I in next,M do if(I.Name:lower()):sub(1,#y)==y:lower()or(I.DisplayName:lower()):sub(1,#y)==y:lower()then table.insert(K,I)end end return K end local H=s:WaitForChild("\068\101\102\097\117\108\116\067\104\097\116\083\121\115\116\101\109\067\104\097\116\069\118\101\110\116\115")local O=H:WaitForChild("\083\097\121\077\101\115\115\097\103\101\082\101\113\117\101\115\116")local T=(H:WaitForChild("\079\110\077\101\115\115\097\103\101\068\111\110\101\070\105\108\116\101\114\105\110\103")).OnClientEvent local function t(s,I)local V=K()y(4)firesignal(s,I)y(V)end local Q={fakechat=function(y,K,s,I)local V=j(K[2])for y,K in next,V do t(T,S(K,I,false))end end,fakewhisper=function(y,K,s,I)local V=j(K[2])for y,K in next,V do t(T,S(K,I,true))end end}Q.fw=Q.fakewhisper Q.fc=Q.fakechat FakeChatStorage.UI=Y("\083\099\114\101\101\110\071\117\105",{ResetOnSpawn=false,Parent=gethui and gethui()or b:FindFirstChildWhichIsA("\083\099\114\101\101\110\071\117\105")or b})local q=FakeChatStorage.UI local d=Y("\070\114\097\109\101",{Parent=q,BackgroundColor3=Color3.fromRGB(0,0,0);BorderSizePixel=0,Position=UDim2.new(.5,-210,1,0),Size=UDim2.new(0,420,0,40)})local f=Y("\070\114\097\109\101",{Parent=d;BackgroundTransparency=1,Position=UDim2.new(0,2,0,2),Size=UDim2.new(1,-4,1,-4)})local w=Y("\084\101\120\116\066\111\120",{Parent=f,BackgroundColor3=Color3.fromRGB(81,87,98);BorderSizePixel=0,BackgroundTransparency=.5,Size=UDim2.new(1,0,1,0);Font=Enum.Font.Ubuntu,Text="";TextColor3=Color3.fromRGB(200,200,200);TextScaled=true,TextSize=14.0,TextWrapped=true})Y("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,5);Parent=d})Y("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,5),Parent=f})local e=TweenInfo.new(.5,Enum.EasingStyle.Bounce)local n=V:Create(d,e,{Position=UDim2.new(.5,-d.AbsoluteSize.X/2,.9,-60)})local C=V:Create(d,e,{Position=UDim2.new(.5,-d.AbsoluteSize.X/2,1,0)})local o=false function toggle()if not o then o=true if d.Position.X.Offset==0 then C:Play()w:ReleaseFocus()w.Text=""C.Completed:Wait()else n:Play()w:CaptureFocus()n.Completed:Wait()end o=false end end w.FocusLost:Connect(function(y)o=true if y then local y=w.Text local K=y:split(" ")if K[2]then local s=K[1]:lower()if(#s+#K[2])+3<=#y then local I=y:sub((#s+#K[2])+3,#y)if Q[s]then Q[s](y,K,s,I)end end end end C:Play()w:ReleaseFocus()w.Text=""C.Completed:Wait()o=false end)I.InputBegan:Connect(function(y,K)if not K then if y.UserInputType==Enum.UserInputType.Keyboard then local K=y.KeyCode if K==(prefix or Enum.KeyCode.Quote)then m.Heartbeat:Wait()toggle()end end end end)local g=Instance.new("\072\105\110\116",b)g.Text="\070\105\120\101\100 \116\104\101 \099\111\109\109\097\110\100 \098\097\114 \111\112\101\110\105\110\103 \119\105\116\104 \101\118\101\114\121 \098\117\116\116\111\110 \112\114\101\115\115\101\100 \040\102\111\114\103\111\116 \116\111 \097\100\100 \'\040\041\'\041"task.delay(10,function()g:Destroy()end)
--[[
	Chat Color Calculator can be found: C:\Users\%Username%\AppData\Local\Roblox\Versions\whateverrobloxversionitis\ExtraContent\scripts\CoreScripts\Modules\Server\ServerChat\DefaultChatModules
]]

if FakeChatStorage and FakeChatStorage.UI and FakeChatStorage.Connections then
	FakeChatStorage.UI:Destroy()
	for i,v in next, FakeChatStorage.Connections do
		v:Disconnect()
	end
end

getgenv().FakeChatStorage = {Connections = {},UI = nil}
local setthreadlevel = syn and syn.set_thread_identity or set_thread_identity or setidentity or setthreadidentity
local getthreadlevel = syn and syn.get_thread_identity or get_thread_identity or getidentity or getthreadidentity

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local ChatService = game:GetService("Chat")
local CoreGui = game:GetService("CoreGui")
local Players = game:GetService("Players")
local rs = game:GetService('RunService')
if not Players.LocalPlayer then
	Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
end
local lp = Players.LocalPlayer
local connections = FakeChatStorage.Connections
local plrlist = {}

connections["OnJoin"] = Players.PlayerAdded:Connect(function(plr)
	plrlist[plr] = plr
end)

connections["OnLeave"] = Players.PlayerRemoving:Connect(function(plr)
	plrlist[plr] = nil
end)

for i,v in next, Players:GetPlayers() do
	plrlist[v] = v
end

local function Create(instance, properties, children)
    local obj = Instance.new(instance)

    for i, v in next, properties or {} do
        obj[i] = v
        for _, child in next, children or {} do
            child.Parent = obj;
        end
    end
    return obj;
end

local NAME_COLORS = {
	Color3.new(253/255,41/255,67/255),
	Color3.new(1/255,162/255,255/255),
	Color3.new(2/255,184/255,87/255),
	BrickColor.new("Bright violet").Color,
    BrickColor.new("Bright orange").Color,
	BrickColor.new("Bright yellow").Color,
    BrickColor.new("Light reddish violet").Color,
	BrickColor.new("Brick yellow").Color
}

local function GetNameValue(pName)
	local value = 0

	for index = 1,#pName do
		local cValue = string.byte(string.sub(pName,index,index))
		local reverseIndex = #pName - index + 1
		if #pName%2 == 1 then
			reverseIndex = reverseIndex - 1
		end
		if reverseIndex%4 >= 2 then
			cValue = - cValue
		end
		value = value + cValue
		end
	return value
end

local function nameValue(pName)
	return NAME_COLORS[(GetNameValue(pName) % #NAME_COLORS) + 1]
end

local function fakechat(plr,msg,whisper)	
	local plrname = plr.Name
			
	local data = {
		ID = math.random(),
		FromSpeaker = plr.DisplayName,
		SpeakerUserId = plr.UserId,
		OriginalChannel = whisper and "From "..plrname or "All",
		IsFiltered = true,
		MessageLength = string.len(msg),
		Message = msg,
		MessageType = "Message",
		Time = os.time()+10,
		ExtraData = plr.Team and plr.Team.TeamColor.Color or {NameColor = nameValue(plrname)}
	}

    if plr and plr.Character and plr.Character:FindFirstChild("Head") then
        ChatService:Chat(plr.Character:FindFirstChild("Head"),msg,0)
    end

    return data
end

local classtypes = {
	['me'] = function()
		return {lp}
	end,
    ["others"] = function()
		local plrlistCache = plrlist
		plrlistCache[lp] = nil
		return plrlistCache
	end,
    ["all"] = function()
		return plrlist
	end
}

local function getPlayer(str)
	local targs = {}
	if classtypes[str:lower()] then
		return classtypes[str:lower()]()
	end
	for i,v in next, plrlist do
		if v.Name:lower():sub(1, #str) == str:lower() or v.DisplayName:lower():sub(1,#str) == str:lower() then
			table.insert(targs, v)
		end
	end
	return targs
end

local DefaultChatSystemChatEvents = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local SayMessageRequest = DefaultChatSystemChatEvents:WaitForChild("SayMessageRequest")
local OnMessageDoneFilteringOnClientEvent = DefaultChatSystemChatEvents:WaitForChild("OnMessageDoneFiltering").OnClientEvent

local function fireevent(signal,data)
    local old = getthreadlevel()
    setthreadlevel(4)
    firesignal(signal,data)
    setthreadlevel(old)
end

local cmdlist = {
    ["fakechat"] = function(msg,args,cmd,fakemessage)
        local target = getPlayer(args[2])
        for i,v in next, target do
            fireevent(OnMessageDoneFilteringOnClientEvent,fakechat(v,fakemessage,false))
        end
    end,
    ["fakewhisper"] = function(msg,args,cmd,fakemessage)
        local target = getPlayer(args[2])
        for i,v in next, target do
            fireevent(OnMessageDoneFilteringOnClientEvent,fakechat(v,fakemessage,true))
        end
    end
}
cmdlist["fw"] = cmdlist["fakewhisper"]
cmdlist['fc'] = cmdlist["fakechat"]

FakeChatStorage.UI = Create("ScreenGui",{ResetOnSpawn = false,Parent = (gethui and gethui()) or CoreGui:FindFirstChildWhichIsA("ScreenGui") or CoreGui})
local UI = FakeChatStorage.UI
local CmdBarBackground = Create("Frame",{Parent = UI,BackgroundColor3 = Color3.fromRGB(0,0,0),BorderSizePixel = 0,Position = UDim2.new(0.5, -210, 1, 0),Size = UDim2.new(0, 420, 0, 40)})
local Main = Create("Frame",{Parent = CmdBarBackground,BackgroundTransparency = 1,Position = UDim2.new(0, 2, 0, 2),Size = UDim2.new(1, -4, 1, -4)})
local TextBox = Create("TextBox",{Parent = Main,BackgroundColor3 = Color3.fromRGB(81,87,98),BorderSizePixel = 0,BackgroundTransparency = 0.5,Size = UDim2.new(1, 0, 1, 0),Font = Enum.Font.Ubuntu,Text = "",TextColor3 = Color3.fromRGB(200,200,200),TextScaled = true,TextSize = 14.000,TextWrapped = true})
Create("UICorner",{CornerRadius = UDim.new(0, 5),Parent = CmdBarBackground})
Create("UICorner",{CornerRadius = UDim.new(0, 5),Parent = Main})


local info = TweenInfo.new(0.5, Enum.EasingStyle.Bounce)
local show = TweenService:Create(CmdBarBackground, info, {Position = UDim2.new(0.5, -CmdBarBackground.AbsoluteSize.X/2, 0.9, -60)})
local hide = TweenService:Create(CmdBarBackground, info, {Position = UDim2.new(0.5, -CmdBarBackground.AbsoluteSize.X/2, 1, 0)})
local tweening = false

function toggle()
    if not tweening then
        tweening = true
        if CmdBarBackground.Position.X.Offset == 0 then
            hide:Play()
            TextBox:ReleaseFocus()
            TextBox.Text = ''
            hide.Completed:Wait()
        else
            show:Play()
            TextBox:CaptureFocus()
            show.Completed:Wait()
        end
        tweening = false
    end
end

TextBox.FocusLost:Connect(function(enterPressed)
    tweening = true
    if enterPressed then
        local originalstring = TextBox.Text
        local args = originalstring:split(' ')
		if args[2] then
			local cmd = args[1]:lower()
			if #cmd+#args[2]+3 <= #originalstring then
				local msg = originalstring:sub(#cmd+#args[2]+3,#originalstring)
				
				if cmdlist[cmd] then
					cmdlist[cmd](originalstring,args,cmd,msg)
				end
			end
		end
    end
    hide:Play()
    TextBox:ReleaseFocus()
    TextBox.Text = ''
    hide.Completed:Wait()
    tweening = false
end)

UserInputService.InputBegan:Connect(function(input, gp)
    if not gp then
        if input.UserInputType == Enum.UserInputType.Keyboard then
            local key = input.KeyCode
            if key == (prefix or Enum.KeyCode.Quote) then
				rs.Heartbeat:Wait()
                toggle()
            end
        end
    end
end)

local a = Instance.new("Hint",CoreGui)
a.Text = "Fixed the command bar opening with every button pressed (forgot to add '()')"
task.delay(10,function()
a:Destroy()
end)
