Why this doesn't work?

Hey! I want this to work but it won’t basically just teleports the character up to the sky and then the trace checks if anything is below the character and if it does then teleports it on top of the object below it.

LineTraceByChannel need the End of line segment, just like you did at the Start (but Z need to have a negative value for End). From Break Hit Result you need to use Impact Point not Location.
This works if your character is already in the required location (up to the sky).

And could you say how could i prevent the character from moving outsidr of the 3 layers with an invible volume or something?

I’m afraid I do not understand the question. What layers?

You can use Blocking Volume. Blocking Volumes will not let character pass through them, but character can be teleported to a place without them.

The game is a sidescroller game based on three layers which can be switched but you couldn’t teleport basically out of the map.

But if i do that it teleports me on to the blocking volume or into it. Shouldn’t do something in the script for it? Or just basically letting the player use his teleport ability in between given coordinates?

I tried what you said but if it doesn’t have an object right behind it or beside it it teleports it to nowhere but if it has then it teleports him where it should.

Yes, you can Clamp the XYZ for location, between given coordinates. I don’t know how you choose the location for teleports, so this can be a solution.

The Start and End inputs for trace look wrong for me (see my image below).

Maybe is a misunderstanding. Do you want to find the object that is beside character or under character?

If you want to find the beside object, than for Start and End don’t use the Z value, use the X or Y with positive and negative value.

In my example image you will make a trace from character location, 1000 units above him and 1000 units under him.

I want to teleport it on the X with 200 units and find an object below it on the Z axis. So put it up in the sky above the next layer and then check what object mesh or something is below it so it would teleport it on.

OK, I understand what you want to do.

You may want to try the blueprint from below image. It works perfect for me, maybe it is not perfect but you can improve that.

I used the Get Forward Vector to make the trace always in front of the character.

Let me know if it works for you.

your end point also needs the same x offset

So I’ve maded, Thanks for the help. Here’s the final script that works if someone needs it.

Happy to help.

Your version will create problems.

You can click the checkmark to mark the answer accepted. Lets others know the question is resolved.