Run it
Copy the script and paste it into your executor.
() :();
SECRET_KEY = ;
CLOSE_RANGE_ONLY = ;
.MESSAGE_SETTINGS = {
[] = ,
[] = ,
[] = ,
};
.WHITELISTED = {
[] = ,
};
.BLACKLISTED = {
[] = ,
};
.OpenAI SECRET_KEY == ;
.OpenAI = ;
ReplicatedStorage = :();
Players = :();
HttpService = :();
LocalPlayer = Players.LocalPlayer;
SayMessageRequest = ReplicatedStorage:():();
Debounce = ;
(Prompt)
.({
Url = ,
Method = ,
Headers = {
[] = ,
[] = .. SECRET_KEY
},
Body = HttpService:({
model = ,
prompt = Prompt,
temperature = ,
max_tokens = ,
top_p = ,
frequency_penalty = ,
presence_penalty = ,
stop = {, }
});
});
()
.Chatted:((Message)
Character = .Character;
Character Character:() LocalPlayer.Character LocalPlayer.Character:() ;
Debounce #Message < .MESSAGE_SETTINGS[] #Message > .MESSAGE_SETTINGS[] ;
CLOSE_RANGE_ONLY .BLACKLISTED[.Name] (Character.Head.Position - LocalPlayer.Character.Head.Position).Magnitude > .MESSAGE_SETTINGS[] .WHITELISTED[.Name] ;
Debounce = ;
HttpRequest = ( .. Message .. );
Response = .Name .. .. .(.(HttpService:(HttpRequest[]).choices[].text, ), , );
#Response <
SayMessageRequest:(Response, );
();
Debounce = ;
( .. Response);
#Response - <
SayMessageRequest:(.(Response, , ), );
(, ()
SayMessageRequest:(.(Response, ), );
();
Debounce = ;
)
SayMessageRequest:(, );
();
Debounce = ;
)
i,v (Players:())
v.Name ~= Players.LocalPlayer.Name
(v);
Players.PlayerAdded:((Player)
(Player);
)
();
how to use: - create an account in https://openai.com/api/ - go to Manage Account -> API Key (https://beta.openai.com/account/api-keys), copy the api key and paste it inside the SECRET_KEY variable - write the name of people you want the bot to reply to, inside the WHITELISTED table (or simply enable the CLOSE_RANGE_ONLY variable if you want it to answer everyone around you) - enjoy notes: - the bot will only reply to texts that has > 15 characters and < 50 characters (you can change these settings in the script, inside the MESSAGE_SETTINGS table) - there's a cooldown between replies in order to not spam the API, 5 seconds - if the response is > 200 characters (roblox chat limit) then the text will be cut in 2 parts Showcase: https://medal.tv/games/roblox/clips/qCW0QQDYnfptO/d1337r0YtsZw?invite=cr-MSw3ckssMTY4NjEyMzcs Credits to BillsTheGod on v3rmillion Original thread: https://v3rmillion.net/showthread.php?tid=1176455 If you have a v3rmillion account, consider liking the thread post so that the user gets the 500 likes badge