[SOLVED] Why my code dont works and gives me a 400 (Bad Req.) error?

Hello,

I was trying to make an AI that using an Rest API.
I even tried changing http to https…
Like it dont want to work.

Here the script:

-- Main Script
local httpService = game:GetService("HttpService")

------------------------------------------------ This is a typeWriter Effect dont mind that
local function typeWriterEffect(object, text)
	for i = 1,#text,1 do
		object.Text = string.sub(text,1,i)
		wait(0.05)
	end

end
------------------------------------------------- 

script.Parent.Parent.Parent.button.MouseButton1Click:Connect(function()

	local data = httpService:GetAsync("https://random-rest-api-that-i-use.lol/api/apikey&msg=".. script.Parent.Text) -- URL is similar to original URL
	data = httpService:JSONDecode(data)
	local aa = data.cnt
	typeWriterEffect(script.Parent.Parent.Parent.mainFrame.Answer, aa)
end)


Script is under of a TextBox.

You have to have HTTP requests enabled in the game settings. It should be under the security tab.

HTTP requests are enabled in my game

Can you post the HTTP 400 error from the console here?

Okay:

Double check your API link and make sure that there isn’t a typo in it.

There is no typo or anything.

If I type a exact message like “Hello” it dont throws a error. Just a answer

I’ll have to take a look at it here in a bit in studio.

Can you find something yet? idk why it happens tho

I fixed the issue using a fire remote