Knit returns "Promise(started)" when I try to return a table

I’m not the most familiar with promises. I’m requesting from the a client controller to a client exposed method on the server like so:

-- client controller
local function loadGarage()
	local contentBar = mainMenu.Background.MyGarage.ContentBar
	local ownedCars = self.CarService:GetCars(game.Players.LocalPlayer)
	print(ownedCars) -- prints "Promise(Started)"
end


-- server service
function CarService.Client:GetCars(playerRequested)
	local cars = self.Server:GetCars(playerRequested)
	print(cars) -- prints the table
	return cars
end

Any advice appreciated.

2 Likes

Okay I picked up some stuff on promises & figured out how to handle this!

local function loadGarage()
		
	local function thisTest(tabletest)
		print(tabletest) -- prints the table
	end
		
	local contentBar = mainMenu.Background.MyGarage.ContentBar
	self.CarService:GetCars(game.Players.LocalPlayer):andThen(thisTest)
end	
2 Likes

Hey to avoid using “andThen” you can disable by setting ServicePromises to false in the Knit Options. Remember that Knit has an API that you can check out.
Knit API : Knit | Knit

Knit.Start({ServicePromises = false})

5 Likes