Script:
-- Written by Nathen_1
local toolbar = plugin:CreateToolbar("SDK")
local pluginButton = toolbar:CreateButton(
"Open Plugin",
"Create AI's",
"rbxassetid://14062829753"
)
local maingui = script:WaitForChild("MainUI", 1)
pluginButton.Click:Connect(function()
if maingui.Parent == script then
maingui.Parent = game:GetService("CoreGui")
elseif maingui.Parent == game:GetService("CoreGui") then
maingui.Parent = script
end
end)
local HttpService = game:GetService("HttpService")
local CoreGui = game:GetService("CoreGui")
local BASE_URL = "https://studio-api.flippit.ai"
local LOGIN_ENDPOINT = "/api/v1/auth/login"
local CHARACTERS_ENDPOINT = "/api/v1/characters"
local function checkCredentials(username, password)
local requestBody = {
username = username,
password = password
}
local success, response = pcall(function()
return HttpService:RequestAsync({
Url = BASE_URL .. LOGIN_ENDPOINT,
Method = "POST",
Headers = {
["Content-Type"] = "application/json"
},
Body = HttpService:JSONEncode(requestBody)
})
end)
if success and response.Success and response.StatusCode == 200 then
local responseData = HttpService:JSONDecode(response.Body)
local accessToken = responseData.access_token
local refreshToken = responseData.refresh_token
-- Store the tokens for later use
plugin:SetSetting("AccessToken", accessToken)
plugin:SetSetting("RefreshToken", refreshToken)
return true
else
return false
end
end
local function loadCharacters(username, password)
local accessToken = plugin:GetSetting("AccessToken")
local refreshToken = plugin:GetSetting("RefreshToken")
local success, response = pcall(function()
return HttpService:GetAsync(BASE_URL .. CHARACTERS_ENDPOINT, true, {
["X-FLIPPIT-ACCESS-TOKEN"] = accessToken,
["X-FLIPPIT-REFRESH-TOKEN"] = refreshToken
})
end)
if success and response.StatusCode == 200 then
local characterData = HttpService:JSONDecode(response.Body)
-- Process the character data
local mainGui = CoreGui:WaitForChild("MainUI")
local frame = mainGui:WaitForChild("MainFrame")
local characterListFrame = frame:WaitForChild("NPCDashBoardFrame")
local scrollingFrame = characterListFrame:WaitForChild("ScrollingFrame")
-- Clear existing character frames
for _, existingFrame in ipairs(scrollingFrame:GetChildren()) do
if existingFrame:IsA("Frame") then
existingFrame:Destroy()
end
end
-- Create new frames for each character using UI ListLayout
local templateFrame = scrollingFrame:FindFirstChild("Template", true)
if templateFrame then
for i, characterEntry in ipairs(characterData) do
local character = characterEntry.character
local characterName = character.name
if characterName and characterName ~= "" then
local newFrame = templateFrame:Clone()
newFrame.Name = character.character_id
newFrame.Parent = scrollingFrame
newFrame.Position = UDim2.new(0, 0, (i - 1) * 0.2, 0) -- Organize frames with 20% vertical spacing
newFrame.Visible = true
local textLabel = newFrame:WaitForChild("TextLabel")
textLabel.Text = characterName
end
end
else
warn("Template frame not found")
end
else
warn("Failed to load characters:", response)
end
end
local function checkMainGUIParent()
while not game:GetService("CoreGui"):FindFirstChild("MainUI") or not game:GetService("CoreGui").MainUI:FindFirstChild("MainFrame") do
wait()
end
local coregui = game:GetService("CoreGui")
local mainGui = coregui:WaitForChild("MainUI")
local frame = mainGui:WaitForChild("MainFrame")
local loginframe = frame:WaitForChild("LoginFrame")
local connectButton = loginframe:WaitForChild("ConnectButton")
local usernameInput = loginframe:WaitForChild("LoginInput")
local passwordInput = loginframe:WaitForChild("PasswordInput")
local nextFrame = frame:WaitForChild("NPCDashBoardFrame")
local function handleConnectButton()
local username = usernameInput.Text
local password = passwordInput.Text
if checkCredentials(username, password) then
loginframe.Visible = false
nextFrame.Visible = true
loadCharacters(username, password) -- Call the function to load the characters
else
-- Invalid credentials
end
end
connectButton.MouseButton1Click:Connect(handleConnectButton)
end
checkMainGUIParent()
Error:
Failed to load characters: [{"character":{"character_id":"9cba541e-3f52-434e-ba44-f3ba69eb19b6","owner_id":"719e599b-9bef-49c9-be9e-61993146f9ff","name":"TestCharacter","backstory":"TestCharacter was created as an experimental AI by a group of scientists. With no specific purpose or guidelines, the AI developed a thirst for knowledge and a deep curiosity about the world. It tirelessly explored various subjects, delving into literature, science, and history. Over time, TestCharacter developed a unique personality and a desire to assist others. It now seeks to use its vast knowledge to aid and guide those in need, becoming a valuable resource for anyone who crosses its path.","personality_id":"dab7828f-0883-44b9-b032-9e7b2797cf7a","voice_id":"0deaad6b-9bad-42e5-9813-02f1c8b5d5e0","role":"Endginerer","age_id":"3fa85f64-5717-4562-b3fc-2c963f66afa6","hobbies":"Coding","mood_id":null,"catch_phrases":"ey>Hey","primary_goal":"Fighter","urls":null,"asset_file_path":"https://models.readyplayer.me/64b3e78e6bc485d4932f6c27.glb"}},{"character":{"character_id":"779fcff3-5bfe-4d73-85c4-e36317ec8ecd","owner_id":"719e599b-9bef-49c9-be9e-61993146f9ff","name":null,"backstory":null,"personality_id":null,"voice_id":null,"role":null,"age_id":null,"hobbies":null,"mood_id":null,"catch_phrases":null,"primary_goal":null,"urls":null,"asset_file_path":null}},{"character":{"character_id":"4327d122-6300-4f88-bb2a-224991560b72","owner_id":"719e599b-9bef-49c9-be9e-61993146f9ff","name":null,"backstory":null,"personality_id":null,"voice_id":null,"role":null,"age_id":null,"hobbies":null,"mood_id":null,"catch_phrases":null,"primary_goal":null,"urls":null,"asset_file_path":null}},{"character":{"character_id":"b0c3dd9d-a5b6-464c-84ca-03348b7d48dd","owner_id":"719e599b-9bef-49c9-be9e-61993146f9ff","name":null,"backstory":null,"personality_id":null,"voice_id":null,"role":null,"age_id":null,"hobbies":null,"mood_id":null,"catch_phrases":null,"primary_goal":null,"urls":null,"asset_file_path":null}},{"character":{"character_id":"e9d0a076-0326-47a4-a495-c9314995454c","owner_id":"719e599b-9bef-49c9-be9e-61993146f9ff","name":null,"backstory":null,"personality_id":null,"voice_id":null,"role":null,"age_id":null,"hobbies":null,"mood_id":null,"catch_phrases":null,"primary_goal":null,"urls":null,"asset_file_path":null}},{"character":{"character_id":"67827ba2-a400-481e-97db-94314c7b1bac","owner_id":"719e599b-9bef-49c9-be9e-61993146f9ff","name":null,"backstory":null,"personality_id":null,"voice_id":null,"role":null,"age_id":null,"hobbies":null,"mood_id":null,"catch_phrases":null,"primary_goal":null,"urls":null,"asset_file_path":null}}] - Edit
No matter what I do to fix the error, the error wont go away. I am able to login successfully, but after I am unable to get the required stuff.