# SetTextOpacity

**URL:** <https://forums.unrealengine.com/t/settextopacity/1909825>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [June 20, 2024, 5:10am UTC](https://forums.unrealengine.com/t/settextopacity/1909825 "2024-06-20T05:10:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![OriginalTomGanks](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OriginalTomGanks](https://forums.unrealengine.com/u/OriginalTomGanks)\
**Post date:** [June 20, 2024, 5:10am UTC](https://forums.unrealengine.com/t/settextopacity/1909825/1 "2024-06-20T05:10:16Z")

</div>

Hello,  
I’m trying to understand how I can use SetTextOpacity on a text\_block. Looking at the function:

# Sets the opacity of the displayed text.

```
        SetTextOpacity<native><public>(InOpacity:type {_X:float where 0.000000 <= _X, _X <= 1.000000}):void

```

Which I’ve been able to figure it is a type macro. I wanted to fade text in and out in a suspend function. It will accept a float directly, but if I put the same float in a varialbe, no luck. Any help would be greatly appreciated.  
Cheers!

---

<div class="post-metadata">

**Author:** ![baxyrl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@baxyrl](https://forums.unrealengine.com/u/baxyrl)\
**Post date:** [June 22, 2024, 2:45pm UTC](https://forums.unrealengine.com/t/settextopacity/1909825/2 "2024-06-22T14:45:50Z")

</div>

How you can put a variable as a text opacity:  
if (Opacity := type{\_X:float where 0.000000 \<= \_X, \_X \<= 1.000000}[OpacityFloat]): TextBlockChange.SetTextOpacity(Opacity)

Now you just need to figure out a function that modifies the number from 1.0 to 0.0.  
I can imagine that being something like this:  
for (OpacityInt := 0…100):  
OpacityFloat := OpacityInt \* 1.0 / 100.0  
if (Opacity := type{\_X:float where 0.000000 \<= \_X, \_X \<= 1.000000}[OpacityFloat]):  
TextBlock.SetTextOpacity(Opacity)

---

<div class="post-metadata">

**Author:** ![OriginalTomGanks](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@OriginalTomGanks](https://forums.unrealengine.com/u/OriginalTomGanks)\
**Post date:** [June 22, 2024, 11:58pm UTC](https://forums.unrealengine.com/t/settextopacity/1909825/3 "2024-06-22T23:58:10Z")

</div>

> [@baxyrl](#):
>
> if (Opacity := type{\_X:float where 0.000000 \<= \_X, \_X \<= 1.000000}[OpacityFloat])

Really appreciate the help!

```auto
    FadeTextOutOneSecond()<suspends>: void = 
        for( Iteration := 1..9):
            var IntToFloat : float = Iteration * 0.1
            var ReverseFloat : float = 1.0 - IntToFloat
            if (Opacity := type{_X:float where 0.000000 <= _X, _X <= 1.000000}[ReverseFloat]):
                Sleep(0.1)
                WidgetTextBlock.SetTextOpacity(Opacity)

```

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [July 22, 2024, 11:58pm UTC](https://forums.unrealengine.com/t/settextopacity/1909825/4 "2024-07-22T23:58:30Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
