local accountId = "8429752e928072a3e9" --Place your account id you received from Christbru here --Place the corresponding Secret Key in the StringValue named "SecretKey" in this script local maxchats = 10 local timezone = "Europe/Lisbon" --This is the timezone you want the times returned in for your game, this will NOT be per person and MUST be a string from the list below, if it is not the system will default to "US/Eastern".. --[[ACCEPTED TIMEZONES US/Pacific America/Tijuana US/Arizona US/Mountain America/Chihuahua America/Mazatlan America/Mexico_City America/Monterrey Canada/Saskatchewan US/Central US/Eastern US/East-Indiana America/Bogota America/Lima America/Caracas Canada/Atlantic America/La_Paz America/Santiago Canada/Newfoundland America/Buenos_Aires Greenland Atlantic/Stanley Atlantic/Azores Atlantic/Cape_Verde Africa/Casablanca Europe/Dublin Europe/Lisbon Europe/London Africa/Monrovia Europe/Amsterdam Europe/Belgrade Europe/Berlin Europe/Bratislava Europe/Brussels Europe/Budapest Europe/Copenhagen Europe/Ljubljana Europe/Madrid Europe/Paris Europe/Prague Europe/Rome Europe/Sarajevo Europe/Skopje Europe/Stockholm Europe/Vienna Europe/Warsaw Europe/Zagreb Europe/Athens Europe/Bucharest Africa/Cairo Africa/Harare Europe/Helsinki Europe/Istanbul Asia/Jerusalem Europe/Kiev Europe/Minsk Europe/Riga Europe/Sofia Europe/Tallinn Europe/Vilnius Asia/Baghdad Asia/Kuwait Africa/Nairobi Asia/Riyadh Asia/Tehran Europe/Moscow Asia/Baku Europe/Volgograd Asia/Muscat Asia/Tbilisi Asia/Yerevan Asia/Kabul Asia/Karachi Asia/Tashkent Asia/Kolkata Asia/Kathmandu Asia/Yekaterinburg Asia/Almaty Asia/Dhaka Asia/Novosibirsk Asia/Bangkok Asia/Jakarta Asia/Krasnoyarsk Asia/Chongqing Asia/Hong_Kong Asia/Kuala_Lumpur Australia/Perth Asia/Singapore Asia/Taipei Asia/Ulaanbaatar Asia/Urumqi Asia/Irkutsk Asia/Seoul Asia/Tokyo Australia/Adelaide Australia/Darwin Asia/Yakutsk Australia/Brisbane Australia/Canberra Pacific/Guam Australia/Hobart Australia/Melbourne Pacific/Port_Moresby Australia/Sydney Asia/Vladivostok Asia/Magadan Pacific/Auckland Pacific/Fiji --]] local secret = "o22mgrlyxdDDDDlooooolthissecretkeyissoepicxD" --Do not place your secret here, place it in the StringValue in the script.. local pendingChats = {} local playerChat = {} local playerHide = {} local Chats = {} local servChats = {} local RbxUtl = assert(LoadLibrary('RbxUtility')) function explode(div,str) if (div=='') then return false end local pos,arr = 0,{} for st,sp in function() return string.find(str,div,pos,true) end do table.insert(arr,string.sub(str,pos,st-1)) pos = sp + 1 end table.insert(arr,string.sub(str,pos)) return arr end function Decode(out) local block = "\\|\\" local seperator = "\\" local blocks = explode(block,out) for _,text in pairs(blocks) do table.insert(Chats,explode(seperator,text)) end end game.Players.PlayerAdded:connect(function(newPlayer) lastChat = "" playerChat[newPlayer.Name] = false newPlayer.Chatted:connect(function(msg) if string.find(lastChat,string.lower(msg)) then return end lastChat = string.lower(msg) if #servChats >= maxchats then table.remove(servChats,1) end table.insert(servChats,{math.floor(tick()),newPlayer.Name,msg}) if #pendingChats < 3 then table.insert(pendingChats,{['plr']=newPlayer,['msg']=msg}) else local h = Instance.new("Hint",newPlayer.PlayerGui) h.Text = "You can only queqe a max of 3 chats at once to be sent to the server." game:service("Debris"):AddItem(h,3) end end) end) function createHolder(player) player:WaitForChild("PlayerGui") local nGui = Instance.new("ScreenGui",player.PlayerGui) nGui.Name = "GameChat" local nFrame = Instance.new("Frame",nGui) nFrame.Name = "Game" nFrame.BackgroundTransparency = 1 nFrame.Size = UDim2.new(0.5,0,0.25,0) if playerHide[player.Name] then nFrame.Position = UDim2.new(-0.4,0,-0.25,0) end nFrame.ClipsDescendants = true local nChat = Instance.new("TextLabel",nFrame) nChat.Name = "Chat" nChat.BackgroundColor3 = BrickColor.new("Really black").Color nChat.BackgroundTransparency = 0.5 nChat.Size = UDim2.new(1,0,1,0) nChat.TextColor3 = BrickColor.new("Institutional white").Color nChat.TextStrokeColor3 = BrickColor.new("Really black").Color nChat.TextStrokeTransparency = 0.8 nChat.TextWrapped = true nChat.TextXAlignment = "Left" nChat.TextYAlignment = "Bottom" local servButton = Instance.new("TextButton",nGui) servButton.Style = 2 servButton.TextColor3 = BrickColor.new("Institutional white").Color servButton.Text = "Server Chat" servButton.Size = UDim2.new(0.2,0,0.03,0) if playerHide[player.Name] then servButton.Position = UDim2.new(-0.4,0,-0.25,0) else servButton.Position = UDim2.new(0,0,0.25,0) end local gameButton = Instance.new("TextButton",nGui) gameButton.Style = 2 gameButton.TextColor3 = BrickColor.new("Institutional white").Color gameButton.Text = "Global Chat" gameButton.Size = UDim2.new(0.2,0,0.03,0) if playerHide[player.Name] then gameButton.Position = UDim2.new(-0.2,0,-0.25,0) else gameButton.Position = UDim2.new(0.2,0,0.25,0) end local hideButton = Instance.new("TextButton",nGui) hideButton.Style = 2 hideButton.TextColor3 = BrickColor.new("Institutional white").Color hideButton.Size = UDim2.new(0.1,0,0.03,0) if playerHide[player.Name] then hideButton.Text = "Show" else hideButton.Text = "Hide" hideButton.Position = UDim2.new(0.4,0,0.25,0) end servButton.MouseButton1Click:connect(function() playerChat[player.Name] = false servButton.Style = 1 gameButton.Style = 2 end) gameButton.MouseButton1Click:connect(function() playerChat[player.Name] = true gameButton.Style = 1 servButton.Style = 2 end) local moving = false hideButton.MouseButton1Click:connect(function() if not playerHide[player.Name] and not moving then moving = true hideButton.Text = "----" nFrame:TweenPosition(UDim2.new(-0.4,0,-0.25,0),1,5,2) servButton:TweenPosition(UDim2.new(-0.4,0,0,0),1,5,2) gameButton:TweenPosition(UDim2.new(-0.2,0,0,0),1,5,2) hideButton:TweenPosition(UDim2.new(0,0,0,0),1,5,2) playerHide[player.Name] = true delay(2,function() hideButton.Text = "Show" moving = false end) else moving = true hideButton.Text = "----" nFrame:TweenPosition(UDim2.new(0,0,0,0),1,5,2) servButton:TweenPosition(UDim2.new(0,0,0.25,0),1,5,2) gameButton:TweenPosition(UDim2.new(0.2,0,0.25,0),1,5,2) hideButton:TweenPosition(UDim2.new(0.4,0,0.25,0),1,5,2) playerHide[player.Name] = false delay(2,function() hideButton.Text = "Hide" moving = false end) end end) if playerChat[player.Name] then servButton.Style = 2 gameButton.Style = 1 else gameButton.Style = 2 servButton.Style = 1 end return nFrame end local stoprun = false while wait(1) do if stoprun then return end Spawn(function() local chat = pendingChats[1] if not chat then return end table.remove(pendingChats,1) local url = "https://serv.christbru.com/roblox/api/chat.php" --?LogChat&Secret="..secret.."&Username="..chat['plr'].Name.."&UserId="..chat['plr'].userId.."&ChatMsg="..chat['msg'].."&PlaceId="..game.PlaceId local serv = game:GetService("HttpService") local data = serv:JSONEncode({["LogChat"]=1,["Secret"]=secret,["AccountId"]=tostring(accountId),["Username"]=chat['plr'].Name,["UserId"]=tostring(chat['plr'].userId),["ChatMsg"]=chat['msg']}) local out = serv:PostAsync(url,data) end) wait() Spawn(function() local url = "https://serv.christbru.com/roblox/api/chat.php" --?ChatLog&Secret="..secret.."&PlaceId="..game.PlaceId.."&Max="..tostring(maxchats).."&Timezone="..tostring(timezone) local timeout = 50 local serv = game:GetService("HttpService") local data = serv:JSONEncode({["ChatLog"]=1,["Secret"]=secret,["AccountId"]=tostring(accountId),["Max"]=tostring(maxchats),["Timezone"]=timezone}) local out = "" local test,err = ypcall(function() out = serv:PostAsync(url,data) end) if not test then if err == "Http requests are not enabled" then Instance.new("Hint",workspace).Text = "You must enable HttpRequests in order to use this system! Go to Insert->Service->HttpService and check the box next to HttpEnabled." stoprun = true elseif not string.find(err,"WinHttp") then --These are common while roblox initializes Instance.new("Hint",workspace).Text = "Error when making request: "..tostring(err) stoprun = true end end local waited = 0 repeat wait(0.1) waited = waited+1 if waited >= timeout then break end until out Chats = {} Decode(out) for _,player in pairs(game.Players:GetPlayers()) do local guiHolder = player:FindFirstChild("PlayerGui"):FindFirstChild("GameChat") if not guiHolder then guiHolder = createHolder(player) else guiHolder = guiHolder:FindFirstChild("Game") end local oldChats = {} for _,old in pairs(guiHolder:children()) do if old.Name == "ChatBar" then table.insert(oldChats,old) end end guiHolder.Chat.Text = "" if playerChat[player.Name] and out and not string.find(out,secret) and not string.find(out,"trust check failed") and string.find(out,"\\") then for i,v in pairs(Chats) do local nChatBar = Instance.new("Frame") nChatBar.Name = "ChatBar" nChatBar.Size = UDim2.new(1,0,(1/maxchats),0) nChatBar.Position = UDim2.new(0,0,(1/maxchats)*(i-1),0) nChatBar.BackgroundTransparency = 0.8 local nTimeText = Instance.new("TextLabel",nChatBar) nTimeText.Size = UDim2.new(0.15,0,1,0) nTimeText.BackgroundTransparency = 1 nTimeText.TextScaled = true nTimeText.TextColor3 = BrickColor.new("Institutional white").Color nTimeText.Text = tostring(v[1]) local nNameText = Instance.new("TextLabel",nChatBar) nNameText.Size = UDim2.new(0.15,0,1,0) nNameText.Position = UDim2.new(0.15,0,0,0) nNameText.BackgroundTransparency = 1 nNameText.TextXAlignment = "Right" nNameText.TextScaled = true nNameText.TextColor3 = BrickColor.new("Institutional white").Color nNameText.Text = tostring(v[2])..": " local nChatText = Instance.new("TextLabel",nChatBar) nChatText.Size = UDim2.new(0.7,0,1,0) nChatText.Position = UDim2.new(0.3,0,0,0) nChatText.BackgroundTransparency = 1 nChatText.TextXAlignment = "Left" nChatText.TextScaled = true nChatText.TextColor3 = BrickColor.new("Institutional white").Color nChatText.Text = tostring(v[3]) nChatBar.Parent = guiHolder end for _,gone in pairs(oldChats) do gone:Remove() end elseif out and string.find(out,secret) and playerChat[player.Name] then for _,gone in pairs(oldChats) do gone:Remove() end guiHolder:FindFirstChild("Chat").Text = "Unable to get chat logs." elseif out and playerChat[player.Name] then for _,gone in pairs(oldChats) do gone:Remove() end guiHolder:FindFirstChild("Chat").Text = "Unable to get chat logs: "..out elseif not playerChat[player.Name] then for _,gone in pairs(oldChats) do gone:Remove() end for i,v in pairs(servChats) do local nChatBar = Instance.new("Frame") nChatBar.Name = "ChatBar" nChatBar.Size = UDim2.new(1,0,(1/maxchats),0) nChatBar.Position = UDim2.new(0,0,(1/maxchats)*(i-1),0) nChatBar.BackgroundTransparency = 0.8 local nTimeText = Instance.new("TextLabel",nChatBar) nTimeText.Size = UDim2.new(0.15,0,1,0) nTimeText.BackgroundTransparency = 1 nTimeText.TextScaled = true nTimeText.TextColor3 = BrickColor.new("Institutional white").Color nTimeText.Text = tostring(v[1]) local nNameText = Instance.new("TextLabel",nChatBar) nNameText.Size = UDim2.new(0.15,0,1,0) nNameText.Position = UDim2.new(0.15,0,0,0) nNameText.BackgroundTransparency = 1 nNameText.TextXAlignment = "Right" nNameText.TextScaled = true nNameText.TextColor3 = BrickColor.new("Institutional white").Color nNameText.Text = tostring(v[2])..": " local nChatText = Instance.new("TextLabel",nChatBar) nChatText.Size = UDim2.new(0.7,0,1,0) nChatText.Position = UDim2.new(0.3,0,0,0) nChatText.BackgroundTransparency = 1 nChatText.TextXAlignment = "Left" nChatText.TextScaled = true nChatText.TextColor3 = BrickColor.new("Institutional white").Color nChatText.Text = tostring(v[3]) nChatBar.Parent = guiHolder end end end end) end