V1.0.1 Roblox Artificial Intelligence [Chat Bot] AI

ROBLOX ARTIFICIAL INTELLIGENCE [CHAT BOT]

Hello, recently I’ve been working on a NPC Artificial Intelligence Chatting system.
This means that this system/ feature uses actual artificial intelligence and neural networking, which makes the A.I Make it’s own decisions when talking to a user.
This Artificial Intelligence feature will bring a whole new experience through players in game and actual NPC:s.

I’ll be walking you through on how you can get this feature/system on your game.
Do not worry I’ll be explaining everything step-by-step.

At the end you will be able to see the fully working end result.

You can test this feature on this Game Note, It’s group locked only Group Members can test it out.

Update Log!
Please NOTE: Updates can be tested on the Testing game Provided on this post.

    • [V 1 Updates]
      ● [NEW] Added Naming Feature - Allows you to name your A.I This Can be passed when making the api request.
      ● [UPDATED] API route updated - Luiboard AI is now moved Here and nolonger Here (Moved^)
      ● [UPDATED] Getting your Apikey - You can now get your api key via your profile settings! and is no longer here

How does this feature work?

  • This feature uses roblox HttpService which means that uses will need to have https service on their games if they’re considering using this feature.

  • Once your have the https service enabled. You will need to send an api request to Luiboard AI Api. This request will be sent here.

  • Before trying to send any api request you do need to have an api key which can be obtained by going to your profile.

  • Note: You need to log in on the site to obtain your api key. The site uses Discord OAuth2 to log you in.

  • Once you have your api key you’re all set to get started

What is Luiboard?

  • Luiboard is a website I developed to help and offer roblox developers open source resources from scripting system to models [WIP]

SET UP

  • Now assuming you’ve read though the top section of this post and you have your api key I’ll show you have you can test this feature our or even potentially add it to your game.

Let’s start with setting up this feature for testing.

Workspace

ServerScriptService

  • On here add a server script and continue write down the code below
--We will start with getting HTTPService
--// Services
local Players = game:GetService("Players")
local SS = game:GetService("ServerStorage")
local Chat = game:GetService("Chat")

--// Imports
--Create a module script in ServerStorage and call it "CoreModule"
-- We will script this module script later on this post.
local CoreModule = require(SS["CoreModule"])

--// Components
-- Here we are getting the npc:s from the workspace
local NPCS = workspace["NPCS"]:GetChildren()

--//Settings
-- Right here we are enabling the beautiful Bubble Chat :)
Chat.BubbleChatEnabled = true

--// Handler
-- Detecting whenever a player joins
Players.PlayerAdded:Connect(function(Player)
-- Detecting whether a player chats
	Player.Chatted:Connect(function(Message)
		CoreModule.FetchRespnose(Message:match("[%P]+"),Player.UserId) -- Calling the function we made on the CoreModule
		local Response = Chat:FilterStringForBroadcast(_G.Res, Player)
		wait(1)
		Chat:Chat(NPCS[1]["Head"],Response)v -- Getting the first NPC:s head on our NPC folder on the workspace and then passing the response where by the NPC will display.
	end)
end)

ServerStorage

  • On the server storage add a module script and name it “CoreModule”

  • Once done let’s get back into coding!

--//Services
local SS = game:GetService("ServerStorage")
local TS = game:GetService("TextService")

local CoreModule = {}

_G.Res = " " -- This is going to be our global response

local HttpService = game:GetService("HttpService") -- We now get to use HTTPService

--// Functions
function CoreModule.FetchRespnose(q,Id) -- This function is going to fetch our response from the luibaord ai api.
	local Request
	local Success, Err = pcall(function() -- We wrap the request fuction in a pcall to avoid getting any errors if something goes wrong.
		Request = HttpService:RequestAsync(
			{
				Url = "https://api.luiboard.com/ai/v1/fetch?message="..tostring(q), -- This is the url we are requesting too!
				Method = "GET",
				Headers = {
					["Content-Type"] = "application/json",
					["apikey"] = "Your api key you got from Luiboard.com", --You can get it by going to your profile on the Luiboard website.
					["id"] = tostring(Id)
				},
			}
		)
	end)
	if not(Success)then
		_G.Res = "Huh?" -- If the request fails we return this string as a response, you can also print out the error right here.
	else
		local Pattern,PatternTable = "\\([ntr])",{n = "\n", t ="\t", r = " "} -- This is a regex Pattern I made to get rid of all the ASCII Charcters
		local Pattern2 = "([\"])" -- Right here we get rid of the quotations
		local FetchedResponse = HttpService:JSONDecode(Request.Body) -- Here we turn the JsonData into a Lua Table
		local Response = string.gsub(FetchedResponse.Response:gsub(Pattern, PatternTable),"[\"\\]","")
		local FilteredResponse = ""
		local success, err = pcall(function()
			FilteredResponse = TS:FilterStringAsync(Response, Id) -- Right here we filter the text before seding it to the user
		end)
		if not success then
			_G.Res = "Sorry I did not catch what you said."
		else
			_G.Res = Response -- We return the response.
		end
	end
end
return CoreModule

If you encounter any Issues or need help Mention Me

The clip below displays the end result.
Extended Video Link

If you encounter any Issues or need help Mention Me

You can test this feature on this Game Note, It’s group locked only Group Members can test it out.

  • Feel Free to use this on your NPC’s Sytems.

UNCOPY LOCKED PLACE You will only need your api key.

TESTING PLACE - This place is group locked. But a great place to test it out. It has multiple NPC’s That use this feature.

168 Likes

Hey bud, this is honestly awesome!!! Hours of enjoyment for lockdown, haha! I might use this in my story game and I’ll be sure to give you credit! <3 :laughing: :+1: :rofl:

5 Likes

You’re welcome, If you need any help setting it up etc or having trouble be sure to notify me.

4 Likes

No idea how to get the API but I’ll try figure it out lol. :grimacing:

I’ve documented everything on the post. I’ll uncopy lock the place you see on the video perhaps it would help.

Ayo This Is Dope fr keep it up ma guy

I can’t believe that I actually told a bot everything and proposed to it lol.


The Clown turned out to be myself

28 Likes

Can I have a link to the uncopylocked place? Thanks

1 Like

Does the bot use a cnn or a ga for the neural structure?

2 Likes

Here is the Uncopylocked Game, All you will need is your Api Key,

ROBLOX AI CHATBOT SYSTEM [UNCOPY LOCKED] - Roblox

2 Likes

I did also update the post so It now has the Uncopylocked Place.

1 Like

It does use cnn neural network structure.

1 Like

what is the filter map res? I wonder how the greyscale RaCI’s would look like :thinking:

I mean right now, I’ve made it so that the Ai Can be taught in different occasions, So this means that when you have a conversation with it it will analyse your input and come up with a response, from all the learning it has gotten so far. As If I was to allow it to learn lively it would be chaotic. So it’s more like a ga structure but with cnn.

1 Like

Yea thats why I was a bit confused cause any ai requires back propogation :confused:

1 Like

Well now you know :wink: , It would require me to save and load the chat history of a user in order for it to learn new things which would require additional resources and would need me to find a perfect algorithm to implement this on my current system Which would be time consuming due to me also having other projects I’m currently working on.

1 Like

idk man synapses only a couple bytes ;/

I’m unsure if I’m being a complete buffoon, however every time I attempt to get an API key I’ve got the response {“Response”:“Please login back again to receive your api key.”}, I’ve logged in numerous times; am I an idiot?

What is your discord, I can help you with that.

1 Like

xav#0007 appreciate it, thanks for the swift response.

1 Like