Need help with script

I wanted to make a script where when you put in a word you will get a word that ryhmes with it.

When I run the script nothing happens

this is the output:

Here is the script

-- Define the textbox and button
local TextBox = script.Parent.TextBox
local Button = script.Parent.Button

-- Define the function to find rhyming words
function FindRhymes(word)
	-- Define the URL for the API
	local url = "https://api.datamuse.com/words?rel_rhy="..word

	-- Send a request to the API and get the response
	local response = game:GetService("HttpService"):GetAsync(url, true)
	local decoded = game:GetService("HttpService"):JSONDecode(response)

	-- Loop through the response and add each word to the list
	local rhymes = {}
	for i, wordData in ipairs(decoded) do
		table.insert(rhymes, wordData.word)
	end

	-- Return the list of rhyming words
	return rhymes
end

-- Define the function to handle the button click event
Button.MouseButton1Click:Connect(function()
	-- Get the player who clicked the button
	local player = game.Players:GetPlayerFromCharacter(Button.Parent.Parent)

	-- Get the word from the textbox
	local word = TextBox.Text

	-- Find the rhyming words
	local rhymes = FindRhymes(word)

	-- Send the list of rhyming words to the player
	player:SendNotification(table.concat(rhymes, "\n"))
end)

Check if you enabled “Allow HTTP Requests” in game settings.

I checked and it is just like the one you showed me.

And what should I see from the output, it just looks like there’s lot of mess. Point-out what is the important information for me. From the code, I don’t see any print into the output.

I dont have anything printing I was just wondering if the output would have some error

When you try to decode the data aren’t you suppose to decode the body. I believe you’re trying to decode the response instance and not the body.

Apologies if i’m wrong though

local decoded = game:GetService("HttpService"):JSONDecode(response.Body)

The error message “attempt to call a nil value” at line 41 is typically an indication that a function or variable is undefined or has not been properly defined.

In this case, it is likely that the player variable at line 34 is returning nil if the Button is not a child of a PlayerGui object.

that function does not exist, use print instead.