How to use Hoarsekat with Fusion

I’m trying to use the Hoarsekat plugin to view UI made with Fusion. I’m using just the basic tutorial code, but cannot view it from the plugin.


when I click either button, nothing appears. I also don’t know if it’s possible to get working without the .story on the modules.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Fusion = require(ReplicatedStorage.Fusion)

local New = Fusion.New
local Children = Fusion.Children

local gui = New "ScreenGui" {
    Parent = Players.LocalPlayer.PlayerGui,

    Name = "MyFirstGui",
    ResetOnSpawn = false,
    ZIndexBehavior = "Sibling",

    [Children] = {
        New "TextLabel" {
            Position = UDim2.fromScale(.5, .5),
            AnchorPoint = Vector2.new(.5, .5),
            Size = UDim2.fromOffset(200, 50),

            Text = "Fusion is fun :)"
        },

        New "TextLabel" {
            Position = UDim2.new(.5, 0, .5, 50),
            AnchorPoint = Vector2.new(.5, .5),
            Size = UDim2.fromOffset(200, 50),

            Text = "Two is better than one!"
        }
    }
}
1 Like

Wouldn’t you need to return something for it to actually appear? I imagine Hoarcekat just mounts an instance returned from a module.

I dont see why it would be framework specific unless there’s some framework funkiness I’m unaware of.

Even when I do it doesn’t work :confused:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Fusion = require(ReplicatedStorage.Fusion)

local New = Fusion.New
local State = Fusion.State
local Computed = Fusion.Computed
local OnEvent = Fusion.OnEvent

local function ToggleButton(props)
	local isButtonOn = State(false)

	return New "TextButton" {
		BackgroundColor3 = Computed(function()
			if isButtonOn:get() then
				return Color3.new(0, 1, 0) -- green when toggled on
			else
				return Color3.new(1, 0, 0) -- red when toggled off
			end
		end),
		TextColor3 = Color3.new(0, 0, 0),
		Text = props.message,

		[OnEvent "Activated"] = function()
			isButtonOn:set(not isButtonOn:get())
		end
	}
end

return ToggleButton

My apologies for the bump on this few months old topic, but I couldn’t help but contribute my solution whilst I was searching about the same problem I had and if you don’t use Fusion anymore or silently found the solution, oh well. If you look at Hoarcekat’s example .story script here you can see the entire modulescript returns a single function with a ‘target’ parameter (which acts like the PlayerGui for previews). Simply set the parent of your ScreenGui to the target and it will work.

Here is what my solution would’ve been:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Fusion = require(ReplicatedStorage.Fusion)

local New = Fusion.New
local Children = Fusion.Children

return function(target)
    local gui = New "ScreenGui" {
        Parent = target
    
        Name = "MyFirstGui",
        ResetOnSpawn = false,
        ZIndexBehavior = "Sibling",
    
        [Children] = {
            New "TextLabel" {
                Position = UDim2.fromScale(.5, .5),
                AnchorPoint = Vector2.new(.5, .5),
                Size = UDim2.fromOffset(200, 50),
    
                Text = "Fusion is fun :)"
            },
    
            New "TextLabel" {
                Position = UDim2.new(.5, 0, .5, 50),
                AnchorPoint = Vector2.new(.5, .5),
                Size = UDim2.fromOffset(200, 50),
    
                Text = "Two is better than one!"
            }
        }
    }
end

See if that works for you :slightly_smiling_face:

1 Like

Does that mean I need to create a screengui for every single element tho? I want all my elements to be under a single HUD gui, but I wanna be able to view each element individually in hoarcekat

No, you can create multiple ‘stories’. If you’re using components for your HUD gui, you will have to create a modulescript ‘story’ for each component resulting in something like this:


This is for Roact but it’s pretty much the same with Fusion.