# How do you dynamically create \<localizes\> message?

**URL:** <https://forums.unrealengine.com/t/how-do-you-dynamically-create-localizes-message/829527>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [March 28, 2023, 8:06am UTC](https://forums.unrealengine.com/t/how-do-you-dynamically-create-localizes-message/829527 "2023-03-28T08:06:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gamblyat](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Gamblyat](https://forums.unrealengine.com/u/Gamblyat)\
**Post date:** [March 28, 2023, 8:06am UTC](https://forums.unrealengine.com/t/how-do-you-dynamically-create-localizes-message/829527/1 "2023-03-28T08:06:53Z")

</div>

I’d like to pass dynamic values to UI elements such as numbers that increment. I only seem to be able to define static values though such as  
`TestMessage<localizes> : message = "test"`

Is there any way to create these messages and pass in data such as

```auto
TestMessage<localizes> : message = "test-{Value}"

```

EDIT: Found a solution in-case anyone needs.

```auto
GenericMessage<localizes>(value: string) : message = "{value}"

```

---

<div class="post-metadata">

**Author:** ![Noob.on.Toast](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Noob.on.Toast](https://forums.unrealengine.com/u/Noob.on.Toast)\
**Post date:** [March 28, 2023, 12:52pm UTC](https://forums.unrealengine.com/t/how-do-you-dynamically-create-localizes-message/829527/2 "2023-03-28T12:52:38Z")

</div>

Trying to work out this same issue

Attempting to have a UI element that displays player currency but even when initialising the message the way you have it I get the error “This variable expects to be initialized with a value of type message, but this initializer is an incompatible value of type []char-\>message.(3509)”

var playerCurrency : int = 0  
GenericMessage(value: int) : message = “{playerCurrency}”

Widget := button\_loud{DefaultText := GenericMessage}

---

<div class="post-metadata">

**Author:** ![AJ\_Lakeman](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/aj_lakeman/32/770700_2.png) [@AJ\_Lakeman](https://forums.unrealengine.com/u/AJ_Lakeman)\
**Post date:** [March 28, 2023, 1:37pm UTC](https://forums.unrealengine.com/t/how-do-you-dynamically-create-localizes-message/829527/3 "2023-03-28T13:37:14Z")

</div>

You’ll need to do a bit of setup:

```auto
var Currency : int = 0
```

```auto
CurrencyText<localizes>(CurrentCurrency: int) : message = "{CurrentCurrency}"
```

```auto
CurrencyWidget: text_block = text_block{DefaultTextColor := NamedColors.White}
```

I’ll assume you already have your UI setup, so will skip over that part.

Whenever you update the currency variable, you’ll want to make sure you also update the UI:

```auto
CurrencyWidget.SetText(CurrencyText(Currency))
```

---

<div class="post-metadata">

**Author:** ![MattRix](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mattrix/32/686548_2.png) [@MattRix](https://forums.unrealengine.com/u/MattRix)\
**Post date:** [March 28, 2023, 6:23pm UTC](https://forums.unrealengine.com/t/how-do-you-dynamically-create-localizes-message/829527/4 "2023-03-28T18:23:48Z")

</div>

This is failing because you’re doing `DefaultText := GenericMessage` but GenericMessage is a function, so it should be `DefaultText := GenericMessage("Your text here!")`
