AI Chatbot

MADE BY Sw1ndler

FEATURE:

  • CHAT BOT
  • .
  • A ai chatbot I made – will only respond to people with 15 studs by default

SCRIPT:

local events = game:GetService("ReplicatedStorage"):WaitForChild("DefaultChatSystemChatEvents")
local messageDoneFiltering = events:WaitForChild("OnMessageDoneFiltering")
local players = game:GetService("Players")

getgenv().distanceCheck = 15 -- Responds to people with x studs of you

function respondTo(text)
   content = syn.request(
       {
           Url = "https://api.affiliateplus.xyz/api/chatbot?message=" .. text,  
           Method = "GET"
       }
   )
   content = content.Body
   content = game:GetService("HttpService"):JSONDecode(content)
   response = content["message"]
   return response
end

function distanceTo(part)
   return (game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position - part.Position).magnitude
end

messageDoneFiltering.OnClientEvent:Connect(function(message)
   local player = players:FindFirstChild(message.FromSpeaker)
   local message = message.Message or ""
   
   if player and player ~= game:GetService("Players").LocalPlayer and distanceTo(player.Character.HumanoidRootPart) < distanceCheck then
       game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer(respondTo(message), "All")
   end
end)

⚠️ Warning: Do not download any extensions or anything other than .txt/.lua file, because script will download only in .txt/.lua format or It will redirect you to a pastebin link.

📋 Notice: If you find any of the scripts patched or not working, please report it to Forever4D through Discord. The script will be removed or marked as patched!