1 | if game:GetService("TextChatService").ChatVersion == Enum.ChatVersion.TextChatService then |
2 | |
3 | local self = game:GetService("CoreGui").TopBarApp.TopBarFrame.LeftFrame.ChatIcon.Background |
4 | |
5 | |
6 | local Players, Plrs, CL = {}, game:GetService("Players"):GetPlayers(), "" |
7 | chatwindow, chatbar = |
8 | game:GetService("TextChatService").ChatWindowConfiguration, |
9 | game:GetService("TextChatService").ChatInputBarConfiguration |
10 | chatwindow.Enabled = true |
11 | chatbar.Enabled = true |
12 | for i, v in next, game:GetService("Players"):GetPlayers() do |
13 | Players[v] = { |
14 | Player = v, |
15 | Color = Color3.fromRGB( |
16 | tostring(v.UserId):sub(1, 2), |
17 | tostring(v.UserId):sub(3, 4), |
18 | tostring(v.UserId):sub(5, 6) |
19 | ) |
20 | } |
21 | end |
22 | game:GetService("Players").ChildAdded:Connect( |
23 | function() |
24 | Players = nil |
25 | Players = {} |
26 | for i, v in next, game:GetService("Players"):GetPlayers() do |
27 | Players[v] = { |
28 | Player = v, |
29 | Color = Color3.fromRGB( |
30 | tostring(v.UserId):sub(1, 2), |
31 | tostring(v.UserId):sub(3, 4), |
32 | tostring(v.UserId):sub(5, 6) |
33 | ) |
34 | } |
35 | end |
36 | end |
37 | ) |
38 | game:GetService("Players").ChildRemoved:Connect( |
39 | function() |
40 | Players = nil |
41 | Players = {} |
42 | for i, v in next, game:GetService("Players"):GetPlayers() do |
43 | Players[v] = { |
44 | Player = v, |
45 | Color = Color3.fromRGB( |
46 | tostring(v.UserId):sub(1, 2), |
47 | tostring(v.UserId):sub(3, 4), |
48 | tostring(v.UserId):sub(5, 6) |
49 | ) |
50 | } |
51 | end |
52 | end |
53 | ) |
54 | local g = Instance.new("ScreenGui", game:GetService("CoreGui")) |
55 | g.ResetOnSpawn = false |
56 | new = Instance.new("ScrollingFrame", g) |
57 | new.Position = UDim2.new(0, chatwindow.AbsolutePosition.X, 0, chatwindow.AbsolutePosition.Y) |
58 | new.Size = UDim2.new(0, chatwindow.AbsoluteSize.X, 0, chatwindow.AbsoluteSize.Y) |
59 | new.BackgroundColor3 = Color3.fromRGB(69, 68, 69) |
60 | new.BackgroundTransparency = 0.6 |
61 | new.BorderSizePixel = 0 |
62 | new.CanvasSize = UDim2.new(0, 0, 0, 0) |
63 | new.AutomaticCanvasSize = Enum.AutomaticSize.Y |
64 | newChatBar = Instance.new("TextBox", g) |
65 | newChatBar.BackgroundColor3 = Color3.fromRGB(89, 89, 89) |
66 | newChatBar.BackgroundTransparency = 0.5 |
67 | newChatBar.BorderSizePixel = 0 |
68 | newChatBar.Position = UDim2.new(0, chatbar.AbsolutePosition.X, 0, chatbar.AbsolutePosition.Y) |
69 | newChatBar.PlaceholderText = "Type /help for help" |
70 | newChatBar.Size = UDim2.new(0, chatbar.AbsoluteSize.X, 0, chatbar.AbsoluteSize.Y) |
71 | newChatBar.Font = Enum.Font.GothamMedium |
72 | newChatBar.TextSize = 18 |
73 | newChatBar.TextColor3 = Color3.fromRGB(15, 15, 15) |
74 | newChatBar.Text = "" |
75 | newChatBar.TextTransparency = 0.4 |
76 | newChatBar.ClearTextOnFocus = false |
77 | local corner = Instance.new("UICorner", newChatBar) |
78 | corner.CornerRadius = UDim.new(0, 8) |
79 | chatwindow.Enabled = false |
80 | chatbar.Enabled = false |
81 | |
82 | local ol = Instance.new("UICorner", new) |
83 | ol.CornerRadius = UDim.new(0, 12) |
84 | local layout = Instance.new("UIListLayout", new) |
85 | layout.HorizontalAlignment = Enum.HorizontalAlignment.Center |
86 | function addMessage(Message, Player, Channel) |
87 | local Plr = Player |
88 | local disp = Plr.DisplayName |
89 | local label = Instance.new("TextButton", new) |
90 | |
91 | label.BackgroundTransparency = 1 |
92 | label.Font = Enum.Font.GothamBlack |
93 | label.RichText = true |
94 | |
95 | label.Text = string.format('<font color = "rgb(%03d, %03d, %03d)"><font size = "16">@%s</font></font>: %s', Players[Plr].Color.R * 255, Players[Plr].Color.G * 255, Players[Plr].Color.B * 255, disp, Message) |
96 | label.TextColor3 = Color3.fromRGB(195, 195, 195) |
97 | label.Size = UDim2.new(0, 220, 0, 30 + (#Message / 3)) |
98 | label.TextSize = 14 |
99 | label.TextWrapped = true |
100 | label.MouseButton1Click:Connect(function() |
101 | newChatBar.Text = newChatBar.Text.." @"..disp |
102 | newChatBar:CaptureFocus() |
103 | end) |
104 | end |
105 | newChatBar.FocusLost:Connect( |
106 | function(enter) |
107 | if enter then |
108 | if newChatBar.Text == "/cnsl" or newChatBar.Text == "/console" then |
109 | game:GetService("VirtualInputManager"):SendKeyEvent(true, Enum.KeyCode.F9, false, game) |
110 | game:GetService("VirtualInputManager"):SendKeyEvent(false, Enum.KeyCode.F9, false, game) |
111 | elseif newChatBar.Text == "/help" then |
112 | chatbar.TargetTextChannel:DisplaySystemMessage( |
113 | "To open console: /cnsl" |
114 | ) |
115 | chatbar.TargetTextChannel:DisplaySystemMessage( |
116 | "To download chat: /download" |
117 | ) |
118 | chatbar.TargetTextChannel:DisplaySystemMessage( |
119 | "To clear chat: /clear" |
120 | ) |
121 | chatbar.TargetTextChannel:DisplaySystemMessage( |
122 | "Try doing (/i, /under, /strike Hello)!" |
123 | ) |
124 | elseif newChatBar.Text == "/download" then |
125 | writefile("TCS+", CL) |
126 | elseif newChatBar.Text:sub(1, 2) == "/i" then chatbar.TargetTextChannel:SendAsync(newChatBar.Text:gsub("/i", "")) addMessage([[<i>]]..newChatBar.Text:gsub("/i", "")..'</i>', game:GetService("Players").LocalPlayer, chatbar.TargetTextChannel) elseif newChatBar.Text:sub(1, 6) == "/under" then chatbar.TargetTextChannel:SendAsync(newChatBar.Text:gsub("/under", "")) addMessage([[<u>]]..newChatBar.Text:gsub("/under", "")..'</u>', game:GetService("Players").LocalPlayer, chatbar.TargetTextChannel) elseif newChatBar.Text:sub(1, 7) == "/strike" then chatbar.TargetTextChannel:SendAsync(newChatBar.Text:gsub("/strike", "")) addMessage([[<s>]]..newChatBar.Text:gsub("/strike", "")..'</s>', game:GetService("Players").LocalPlayer, chatbar.TargetTextChannel) elseif newChatBar.Text == "/clear" then for i, v in next, new:GetChildren() do if v.ClassName:find("Text") then v:Destroy() end end |
127 | else |
128 | chatbar.TargetTextChannel:SendAsync(newChatBar.Text) |
129 | end |
130 | newChatBar.Text = "" |
131 | end |
132 | end |
133 | ) |
134 | |
135 | |
136 | game:GetService("TextChatService").MessageReceived:Connect( |
137 | function(Message) |
138 | if Message.TextSource == nil then return end |
139 | |
140 | local matched, matched2, fulltext = string.match(Message.Text, "%*%*(.-)%*%*"), string.match(Message.Text, "%@"), Message.Text |
141 | if matched2 and table.find(Plrs, '@'..matched2) then |
142 | fulltext = fulltext:gsub(matched2, '<font size = "20">'..matched2.."</font>") |
143 | end |
144 | |
145 | if matched then |
146 | fulltext = fulltext:gsub(matched, [[<b><font size = "20"><font color = "rgb(215, 215, 215)">]]..matched.."</font></font></b>") |
147 | end |
148 | |
149 | addMessage(fulltext, game:GetService("Players")[Message.TextSource.Name], Message.TextChannel) |
150 | |
151 | new.CanvasPosition += Vector2.new(0, 50) |
152 | CL = CL.."@"..game:GetService("Players")[Message.TextSource.Name].DisplayName..": "..Message.Text.."\n" |
153 | end |
154 | ) |
155 | print("TCS+") |
156 | end |
157 | game:GetService("UserInputService").InputBegan:Connect( |
158 | function(Input) |
159 | if Input.KeyCode == Enum.KeyCode.Slash then |
160 | newChatBar:CaptureFocus() |
161 | end |
162 | end |
163 | ) |
164 | old = |
165 | hookmetamethod( |
166 | game, |
167 | "__namecall", |
168 | function(Self, ...) |
169 | local Args = {...} |
170 | if getnamecallmethod() == "DisplaySystemMessage" then |
171 | local disp = "System" |
172 | local label = Instance.new("TextLabel", new) |
173 | |
174 | |
175 | label.BackgroundTransparency = 1 |
176 | label.Font = Enum.Font.GothamBlack |
177 | label.RichText = true |
178 | label.Text = string.format('[%s]: <font size = "%d">%s</font>', disp, 14, Args[1]) |
179 | label.TextColor3 = Color3.fromRGB(200, 200, 200) |
180 | label.Size = UDim2.new(0, 220, 0, 30) |
181 | label.TextSize = 15 |
182 | label.Name = "A" |
183 | end |
184 | return old(Self, ...) |
185 | end |
186 | ) |
187 | |
188 | game:GetService("CoreGui").TopBarApp.TopBarFrame.LeftFrame.ChatIcon.Background.MouseButton1Click:Connect(function() |
189 | new.Visible = not new.Visible |
190 | newChatBar.Visible = not newChatBar.Visible |
191 | end) |
192 | |
193 | chatbar.TargetTextChannel:DisplaySystemMessage("Welcome, " .. game:GetService("Players").LocalPlayer.DisplayName.."!") |