# UMG Slider not clamping

**URL:** <https://forums.unrealengine.com/t/umg-slider-not-clamping/441043>\
**Category:** UI\
**Tags:** slider, unreal-engine, clamp, UI, day-night-cycle, question, UMG\
**Created:** [January 10, 2019, 4:06pm UTC](https://forums.unrealengine.com/t/umg-slider-not-clamping/441043 "2019-01-10T16:06:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mueezkh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mueezkh](https://forums.unrealengine.com/u/mueezkh)\
**Post date:** [January 10, 2019, 4:06pm UTC](https://forums.unrealengine.com/t/umg-slider-not-clamping/441043/1 "2019-01-10T16:06:04Z")

</div>

Hey seems like a dumb issue but I’ve been working on a project that involves a day and night cycle for a small city. I’ve created the day and night cycle to work on the slider but can’t figure out how to clamp the slider so the top is Day and the Bottom is night.

If I click and drag the circle on the slider it continues to loop through the day and night cycles even when the mouse is past the lowest point on the bar.

It seems like no matter what number I set the clamp to it continues to cycle to it continues past the number.

![264840-ue1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/b/8/fb8ad58ce86b4d2dc918aa2ef7d13e95842775a7.png)

---

<div class="post-metadata">

**Author:** ![SavvyIndoorsman](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SavvyIndoorsman](https://forums.unrealengine.com/u/SavvyIndoorsman)\
**Post date:** [January 10, 2019, 4:50pm UTC](https://forums.unrealengine.com/t/umg-slider-not-clamping/441043/2 "2019-01-10T16:50:46Z")

</div>

Can you share a bit more about how that widget blueprint is set up? Based on the screenshot you shared, I can’t see any issues, which means the problem is probably hiding elsewhere.

---

<div class="post-metadata">

**Author:** ![mueezkh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mueezkh](https://forums.unrealengine.com/u/mueezkh)\
**Post date:** [January 10, 2019, 5:04pm UTC](https://forums.unrealengine.com/t/umg-slider-not-clamping/441043/3 "2019-01-10T17:04:11Z")

</div>

Yeah sure, I’ve just created a simple cast that calls the BP\_Sky\_Sphere and the Directional Light that’s in the current level. Added a local rotation.

The cycle works, It just isn’t clamping to the correct range.  
I’ve attached the full blueprint:

 ![264873-ue3.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/3/a/93a539cc8173a4a9b9ea9c950262038306a9a7d7.png)

This is all in the graph editor for the UMG UI

---

<div class="post-metadata">

**Author:** ![SavvyIndoorsman](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SavvyIndoorsman](https://forums.unrealengine.com/u/SavvyIndoorsman)\
**Post date:** [January 10, 2019, 5:57pm UTC](https://forums.unrealengine.com/t/umg-slider-not-clamping/441043/4 "2019-01-10T17:57:56Z")

</div>

It looks like your issue is caused by the use of the [Add Actor Local Rotation](http://api.unrealengine.com/INT/BlueprintAPI/Utilities/Transformation/AddActorLocalRotation/index.html) node, which is going to continuously add more and more rotation to your light every time it is called up.

I think what you need is the [Set Actor Rotation](http://api.unrealengine.com/INT/BlueprintAPI/Utilities/Transformation/SetActorRotation/index.html) node, or perhaps the [Set Actor Relative Rotation](http://api.unrealengine.com/INT/BlueprintAPI/Utilities/Transformation/SetActorRelativeRotation/index.html) node if you want to keep the light’s rotation relative to its parent.

Give one of those a shot and let me know if you’re still having the issue.

---

<div class="post-metadata">

**Author:** ![mueezkh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mueezkh](https://forums.unrealengine.com/u/mueezkh)\
**Post date:** [January 10, 2019, 6:08pm UTC](https://forums.unrealengine.com/t/umg-slider-not-clamping/441043/5 "2019-01-10T18:08:02Z")

</div>

Heyy! Thanks so much works like a charm!
