SirMallard / Iris

Iris is an Immediate-Mode GUI Library for Roblox for creating debug and visualisation UI and tools and based on Dear ImGui.
https://sirmallard.github.io/Iris/
MIT License
178 stars 25 forks source link

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

Closed Naymmmm closed 6 months ago

Naymmmm commented 6 months ago

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
Naymmmm commented 6 months ago

Well, I forgot to use task.spawn lol.

SirMallard commented 6 months ago

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