Blueprint script to open a drawer not working?!

Hey, I’m new to unreal engine and scripting.
I’m making a simple horror game with low poly graphics style.
Now I made a blueprint to open a drawer (drawer blueprint with communication to the player character)
Here is what I ended up with:

This is not working. The static mesh of the drawer spawns somewhere in the world.
I tried to take the relative location and add 50 to the Y so that the mesh is moving 50 units forwards.
Hope someone can help me with this. (Maybe a completely new script) :smiley:

your going about setting the locations in a very bad way. luckily its a pretty easy fix.

first to fix the location issues you will first want to delete everything that plugs into the A and B pins of the lerp node, we are going to use definitive locations here. so now for the value of A set it to 0 0 0, thats zero on every axis, for B set the value to 50 0 0, thats fifty on the X axis and zero on the others/ we did it this way so we have set locations to work from and so it doesnt lead to exponential acceleration.

next theres some other issues id like to address, fist i would be setting the location of the drawer 01 to keep things simple and not the actor itself, so you would drag off drawer01 and search for set relative location there (should come up with something like set component relative location). next the way you are setting the open variable is a bit off as you are setting it every time the update is happening which is alot, though this is a moot point given my next suggestion. instead of using the branch at the beginning i would just use a flipflop since theres really only two states the drawer can be in. the way a flipflop works is that each time its activated it uses a different pin and cycles them, so the first time its activated it runs pin A, the second time pin B, the this it goes back to pin A. this eliminated the need for the variable and the settings and all that, it makes it much simpler.

Thank you for your fast answer!
I deleted the variables and put in a flip-flop like you said. This worked perfectly!
But after changing the lerp the mesh is still spawning somewhere in the world after clicking on it.
I think it spawns at world position X: 50 Y: 0 Z: 0

Instead of setting the actor location you want to only be setting the location of the mesh which you have labeled as drawer 01. That way the root stays in one place. Also when you say it spawns some mewhere is that after you run the shown script? Is yes then what i suggested here should help

the mesh is still spawning somewhere
in the world after clicking on it

What are the steps the player needs to take for this to work? Can you show us how you set this actor’s location to match the actor the drawer attaches to? Or how does it work?

Thank you so much!
The problem was that I set the location of the actor and not of the drawer01.
Now it works perfectly! :smiley: