So I’ve been trying to make a simple tic-tac-toe game using the Fusion library made by dphfox, and this error came up that has no help or hint to what’s wrong with my code. I am trying to learn Fusion here, so my code would look like a mess and unoptimized.
Here. The script and the GUI placed on the StarterGUI.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Root = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("Root")
local Fusion = require(ReplicatedStorage.Fusion)
local Computed = Fusion.Computed
local Hydrate = Fusion.Hydrate
local OnEvent = Fusion.OnEvent
local Value = Fusion.Value
local New = Fusion.New
local State = Value(0)
local ClickedState = Value({})
local Buttons = Root.Frame:GetChildren()
for i, Button in ipairs(Buttons) do
Hydrate (Button) {
Text = Computed(function ()
if ClickedState:get()[Button.Name] ~= nil then
return ClickedState:get()[Button.Name]
end
return "-"
end),
[OnEvent "Activated"] = function()
if ClickedState:get()[Button.Name] == nil then
if State:get() == 0 then
ClickedState:set(
table.insert(ClickedState:get(), Button.Name, "O")
)
State:set(1)
else
ClickedState:set(
table.insert(ClickedState:get(), Button.Name, "X")
)
State:set(0)
end
end
end,
}
end
The error I encounter.
18:57:41.197 Error occurred, no output from Lua. - Studio
For clarification, the error came up after I press a hydrated button, with the logic I built in my code. The only hint I got is that the debugging tool referred a code in line 19 it was if ClickedState:get()[Button.Name] ~= nil then with key Text.
I can’t make up solution, so I am here to search for help. Any help is appreciated!