pastebin chatbot local Players = game:GetService("Players") local StarterGui = game:GetService("StarterGui") local HttpService = game:GetService("HttpService") local ReplicatedStorage = game:GetService("ReplicatedStorage") local url = "http://localhost:5000/chat?text=" local newChat = not ReplicatedStorage:FindFirstChild("DefaultChatSystemChatEvents") local function notify(title, text) StarterGui:SetCore("SendNotification", { Title = title; pastebin chatbot How to use it? pastebin chatbot Text = text; Duration = 5; }) print(title..": "..text) end notify("AI Chatbot", "Loading...") -- GUI pastebin chatbot How to dowload it? pastebin chatbot local gui = loadstring(game:HttpGet('https://raw.githubusercontent.com/violin-suzutsuki/LinoriaLib/main/Library.lua'))() -- Window local Window = gui:CreateWindow({ Title = 'AI chatbot', Center = true, AutoShow = false, TabPadding = 8, pastebin chatbot PasteShr pastebin chatbot MenuFadeTime = 0.2 }) -- Main tab local MainTab = Window:AddTab('Main') -- Group local Group = MainTab:AddLeftGroupBox('Chatbot') pastebin chatbot PasteShr pastebin chatbot --- LeftGroupBox:AddToggle('Enabled', { Text = 'Enable chatbot', Default = true, Tooltip = '' }) --- pastebin chatbot How to get it for free? pastebin chatbot LeftGroupBox:AddSlider('Distance', { Text = 'Distance', Default = 15, Min = 0, Max = 100, Rounding = 1, Compact = false }) pastebin chatbot How to get it for free? pastebin chatbot -- End of GUI -- Get the text chat services local TextChatService = game:GetService("TextChatService") local generalChannel = nil if newChat then generalChannel = TextChatService.TextChannels.RBXGeneral end pastebin chatbot How to dowload it? pastebin chatbot if newChat then if not generalChannel then notify("Error", "Unknown chat system (detected as new)") return end notify("Chat system", "New") else if not ReplicatedStorage:FindFirstChild("DefaultChatSystemChatEvents") then notify("Error", "Unknown chat system (detected as old)") return pastebin chatbot How to use it? pastebin chatbot end notify("Chat system", "Old chat system is not supported yet") return end local function splitText(text, chunkSize) local chunks = {} local startPosition = 1 local textLength = string.len(text) pastebin chatbot How to get it? pastebin chatbot while startPosition <= textLength do local endPosition = startPosition + chunkSize - 1 -- Не разрезаем слово, если это возможно if endPosition < textLength then while endPosition > startPosition and string.sub(text, endPosition, endPosition) ~= " " do endPosition = endPosition - 1 end end -- Если нет пробелов, принудительно разрезаем текст if endPosition == startPosition then pastebin chatbot How to use it? pastebin chatbot endPosition = startPosition + chunkSize - 1 end table.insert(chunks, string.sub(text, startPosition, endPosition)) startPosition = endPosition + 1 end return chunks end local function chat(text) pastebin chatbot How to use it? pastebin chatbot local chunks = splitText(text, 200) for i, chunk in ipairs(chunks) do --if newChat then generalChannel:SendAsync(chunk) --else --ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(chunk) --end end end pastebin chatbot How to get it? pastebin chatbot local function getPlayerByUserId(userId) for _, player in pairs(Players:GetPlayers()) do if player.UserId == userId then return player end end return nil end local function onChatMessageReceived(player, text) pastebin chatbot How to dowload it? pastebin chatbot if (player.Character.HumanoidRootPart.Position - Players.LocalPlayer.Character.HumanoidRootPart.Position).Magnitude > Options.Distance.Value then return end local author = player.Name gui:Notify("Chat: " .. text) local resp = HttpService:JSONDecode(syn.request({ Url=url..HttpService:UrlEncode(author.." said: "..text) }).Body) pastebin chatbot How to get it? pastebin chatbot gui:Notify("Reply: " .. resp.reply or resp.error) if resp.reply then chat(resp.reply) end end local GameName = game:GetService("MarketplaceService"):GetProductInfo(game.PlaceId).Name gui:Notify('Game name: ' .. GameName) pastebin chatbot How to get it? pastebin chatbot -- Clear chat history syn.request({ Url = "http://localhost:5000/clear" }) local g = "You are a Roblox player who is in the game called '"..GameName.."' and your in-game name is "..game.Players.LocalPlayer.Name..". Use an informal communication style and try not to make long messages. Don't mention users using @ when replying to them, write the reply text right away. First, say hello to other players!" local res = HttpService:JSONDecode(syn.request({ Url=url .. HttpService:UrlEncode(g) pastebin chatbot How to dowload it? pastebin chatbot }).Body) if res.reply then gui:Notify("Successfully initialized!") chat("AI chatbot enabled") wait(1) chat(res.reply) if newChat then -- Connect the onChatMessageReceived function to the Chat service's MessageReceived event pastebin chatbot How to use it? pastebin chatbot TextChatService.MessageReceived:Connect(function(message) if not Toggles.Enabled.Value then return end if message.TextSource.UserId == Players.LocalPlayer.UserId then return end local player = getPlayerByUserId(message.TextSource.UserId) if not player then notify("Error", "Unable to get player from UserId") end pastebin chatbot PasteShr pastebin chatbot onChatMessageReceived(player, message.Text) end) else Players.PlayerChatted:Connect(function(_type, player, message) if player.UserId == Players.LocalPlayer.UserId then return end onChatMessageReceived(player, message) end) end pastebin chatbot PasteShr pastebin chatbot end pastebin chatbot