Invalid argument #1 to 'next' (table expected, got string)

You can write your topic however you want, but you need to answer these questions:

  1. Im trying to get the definition of a word and seperating each definition

  2. The issue is theres a error “invalid argument #1 to ‘next’ (table expected, got string)”

  3. I looked in the developer hub and looked on youtube

function getDefinition(word)
	local url = ""..word
	local Async = HttpService:GetAsync(url)
	local data = HttpService:JSONDecode(Async) -- Getting the code and turn it into roblox form
	for i, things in pairs(data) do
		local meanings = things.meanings
		for i, num in pairs(meanings) do
			for i,nums in pairs(num) do
				local definitions = nums.definitions
				local lastdefinitions = 0

				for i, v in next, nums  do
					lastdefinitions += 1
				local MinNum = 0
				local MaxNum = lastdefinitions
				for r = MinNum + 1, MaxNum - 1 do
	--				game.ReplicatedStorage.GetDefinition:FireClient(r,nums[r].definition)


nums is being defined as a string, not a table.

I’m thinking you have one too many loops based on this.

how would I lessen the loops or should I change the script?

Just remove one of the loops, I think your table probably looks like,

local data = {
    meanings = {

so each time it gets to the tables inside of meanings, it’s trying to iterate through the number.

Try removing this loop:

for i,nums in pairs(num) do