Michael-48/Iris

"Callback has too few calls to Iris.End()"

Closed this issue · 2 comments

Literally dying because of this error, I have no idea why this is happening.
Code:

-- this thing handles the shop
local StarterPlayerScripts = game.StarterPlayer.StarterPlayerScripts
local Iris = require(StarterPlayerScripts.Token_Debug.Iris).Init()
local TokenEvent = script:WaitForChild("TokenEvent")
local BuyFunction = script:WaitForChild("BuyFunction")

Iris:Connect(function()
	Iris.Window({"Shop Debug"})
	Iris.Text({"Heya, this is a particle shop I guess."})
	if Iris.Button({"Buy the 1st effect and equip (free)"}).clicked() then 
		local status = BuyFunction:InvokeServer(1, game.Players.LocalPlayer)
		if status == "toopoor" then
			warn("user is poor")
		elseif status == "success" then
			print("you did it")
		elseif status == "failed" then
			warn("datastore fail")
		end
	end
	local tokenmnt = Iris.InputNum({"Token Amount"})
	if tokenmnt.numberChanged() then
		TokenEvent:FireServer(game.Players.LocalPlayer, tokenmnt.state.number)
	end
	Iris.End()
end)

The error:

Callback has too few calls to Iris.End()  -  Client - Internal:266
  21:58:57.629  Stack Begin  -  Studio
  21:58:57.629  Script 'StarterPlayer.StarterPlayerScripts.Token_Debug.Iris.Internal', Line 266 - function _cycle  -  Studio - Internal:266
  21:58:57.629  Script 'StarterPlayer.StarterPlayerScripts.Token_Debug.Iris', Line 86  -  Studio - Iris:86
  21:58:57.629  Stack End  -  Studio

Well, I forgot to use task.spawn lol.

Yeah, Iris can't handle asynchronous code. I don't think there's anything we can do to fix that.