# Item count not working

**URL:** <https://forums.unrealengine.com/t/item-count-not-working/420245>\
**Category:** Blueprint\
**Tags:** collectables, unreal-engine, bug-report, UE4, Blueprint, question\
**Created:** [March 19, 2018, 12:54pm UTC](https://forums.unrealengine.com/t/item-count-not-working/420245 "2018-03-19T12:54:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jabbawalden](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jabbawalden](https://forums.unrealengine.com/u/jabbawalden)\
**Post date:** [March 19, 2018, 12:54pm UTC](https://forums.unrealengine.com/t/item-count-not-working/420245/1 "2018-03-19T12:54:22Z")

</div>

Hi guys.

So I have these collectables, and each time they are collected, an integar variable (named Points) on my Character blueprint goes up by 1 (beginning at 0)  
Now upon reaching 7 I want a certain object to begin rotating in the scene.  
My current setup is not working - the object begins rotating instantly even though I’ve not yet collected any of the pick ups.  
The points do increase by 1 each time I pick the item up (I have print stringed it), and the PointsReq var is set to 7.

Here is my script:

 ![234310-action-upon-item-count-script.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/9/7/e97350b1745c54c5e51ebe434ef3b461ed14395d.png)

Any help would be greatly appreciated!

Thanks.

---

<div class="post-metadata">

**Author:** ![ThompsonN13](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ThompsonN13](https://forums.unrealengine.com/u/ThompsonN13)\
**Post date:** [March 19, 2018, 2:42pm UTC](https://forums.unrealengine.com/t/item-count-not-working/420245/2 "2018-03-19T14:42:24Z")

</div>

theres all kinds of errors with your script but this is a pretty simple thing to script so here we go. with this example im assuming that you just want to turn the bridge into position when the player collects enough points and that you dont want the bridge to continue spinning.

the method implemented in the below picture was chosen due to simplicity and because its self contained, there are however other methods that are event oriented. anyways the method in the picture below activates a timer that runs the script every 2 seconds and checks the value of the players point. if the points are above 7 then it uses the timeline to turn the bridge.

 ![234323-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/0/9/909abae9e10609288e45d3d18b068dec7f3218ba.png)

now i will outline a few of the problems with your script. first your script was only being run when the actor is first created so it was only being run once. this means that even if you made it to 7 points nothing would happen. your method of flow control was also a little wonky but probably would have worked for the most part. the next major thing is your set node, the issue here was that its execution pin wasnt connected to anything so it would never be run.

---

<div class="post-metadata">

**Author:** ![jabbawalden](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jabbawalden](https://forums.unrealengine.com/u/jabbawalden)\
**Post date:** [March 22, 2018, 6:53am UTC](https://forums.unrealengine.com/t/item-count-not-working/420245/3 "2018-03-22T06:53:24Z")

</div>

Hi ThompsonN13! Thanks for your response.  
Actually I did want the bridge to be continuously rotating. Your explanation and script was very helpful!

This is what I ended up with

 ![234604-action-upon-item-count-script-solved.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/d/c/6dc66d253dd677e0823c7e4a799235731b2b98ec.jpeg)

:
