# Why can't the function build?

**URL:** <https://forums.unrealengine.com/t/why-cant-the-function-build/2267759>\
**Category:** Programming & Scripting\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [January 9, 2025, 1:07pm UTC](https://forums.unrealengine.com/t/why-cant-the-function-build/2267759 "2025-01-09T13:07:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SimonL\_OSC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SimonL\_OSC](https://forums.unrealengine.com/u/SimonL_OSC)\
**Post date:** [January 9, 2025, 1:07pm UTC](https://forums.unrealengine.com/t/why-cant-the-function-build/2267759/1 "2025-01-09T13:07:55Z")

</div>

Hi everyone

i need some help on one of the following function:

```
CreateButton(_BackgroungTexture:texture, _ContentText : string, _Callback(: widget_message) : void) : canvas =
{
    var btnCanvas : canvas = canvas{}
    btnContent : button_slot = CreateWidgetContent(_BackgroungTexture, _ContentText)        

    case (m_ButtonSetting.GetFontType())
    {
        EButtonFont.None =>
            var btn : button = button{Slot := btnContent}
            btnCanvas.AddWidget(GetDefaultCanvasSlot(btn))
            btn.OnClick().Subscribe(_Callback)
            
        EButtonFont.Loud =>
            var buttonLoud : button_loud = button_loud{DefaultText:=StringToMessage(_ContentText)}
            buttonLoud.OnClick().Subscribe(_Callback)
            btnCanvas.AddWidget(GetDefaultCanvasSlot(buttonLoud))
            btnCanvas.AddWidget(GetDefaultCanvasSlot(btnContent.Widget))

        EButtonFont.Regular =>
            var buttonRegular : button_regular = button_regular{DefaultText:=StringToMessage(_ContentText)}
            buttonRegular.OnClick().Subscribe(_Callback)
            btnCanvas.AddWidget(GetDefaultCanvasSlot(buttonRegular))
            btnCanvas.AddWidget(GetDefaultCanvasSlot(btnContent.Widget))

        EButtonFont.Quiet =>
            var buttonQuiet : button_quiet = button_quiet{DefaultText:=StringToMessage(_ContentText)}
            buttonQuiet.OnClick().Subscribe(_Callback)
            btnCanvas.AddWidget(GetDefaultCanvasSlot(buttonQuiet))
            btnCanvas.AddWidget(GetDefaultCanvasSlot(btnContent.Widget))
    }
    
    return btnCanvas
}

```

because when I try to build my scripts I have this error:  
Script error 3502: Using a value of type type{_(:t-\>void):cancelable} as a value of type type{_(:widget\_message-\>void):cancelable} is not yet implemented.

In fact I have four errors but it’s four times the same on different lines ^^’

In summary, I would like to be able to register a function in the Onclick event as part of the parameters of my function which constructs my button!

I’m not sure I’m very clear in my explanations ^^’

if anyone has a solution to solve my error or another method to do this!  
I’m open to ideas ^^

Thanks in advance ^^

---

<div class="post-metadata">

**Author:** ![KK\_KillStr3aK](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kk_killstr3ak/32/875695_2.png) [@KK\_KillStr3aK](https://forums.unrealengine.com/u/KK_KillStr3aK)\
**Post date:** [January 11, 2025, 10:44am UTC](https://forums.unrealengine.com/t/why-cant-the-function-build/2267759/2 "2025-01-11T10:44:41Z")

</div>

your callback function has a wrong type, maybe use type alias and define the function type as needed

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [January 13, 2025, 11:06am UTC](https://forums.unrealengine.com/t/why-cant-the-function-build/2267759/3 "2025-01-13T11:06:36Z")

</div>

I think it’s a bug, I’m having the same issue here

```auto
parametric_class(t:type) := class<computes>:
    SomeMethod : tuple() -> t

ReturnInt():int=0

SomeParametricClassInt : parametric_class(int) = parametric_class(int):
    SomeMethod := ReturnInt # Script error 3502: Using a value of type tuple()->int as a value of type tuple()->t is not yet implemented.

```

---

<div class="post-metadata">

**Author:** ![SimonL\_OSC](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SimonL\_OSC](https://forums.unrealengine.com/u/SimonL_OSC)\
**Post date:** [January 20, 2025, 3:19pm UTC](https://forums.unrealengine.com/t/why-cant-the-function-build/2267759/4 "2025-01-20T15:19:50Z")

</div>

Hi

Thanks for your answer I will test your solution when I need a callback in a function again ^^

Basically the origin of my problem is that I created full verse UI because I need to call on data in the latter  
But the button that I created is not usable with a controller

So my current problem is to know how to read data on the verse in a umg or how to create totally custom ui buttons interactable by the controller

But I will create another post for that 😉
