Mouse Position to World Vector on specific Plane

I am currently making a new gamemode which runs in 2D with a static camera that has a view of the arena from one specified position. All players can only run in 2D while the map is still 3D. They are basically locked to a specific Y coordinate, because GM:SetupMove disallows them to move forward in relation to the static camera. I have gui.EnableScreenClicker on which releases the mouse so you can click on the screen. What I need help with is how I can make this mouse coordinate transfer into the world and finding that specific Vector with Y valued at 0? (In this map, the plane is locked to Y = 0)

Basically imagine this 2D plane that the players can walk along on. I need the Vector of any point on this plane where the mouse hovers. Or well, really just the general direction from the players. It is supposed to be that when you click with the mouse anywhere, you will shoot in that direction. Here’s a picture on an example map with an example orange plane:

As you can see, the orange plane cuts straight through the middle of the platform.

What are you trying to do? Make aiming for the player with mouse I guess?

There was a gamemode, I think it was called Game Master or something, that did this, so you can look it up and how they did it.

Also see this page:

You could use it with a trace to get a position on the orange wall ( if it is possible to hit )

You can probably use


This is just what I need, although it returns the numbers as userdata. I can print these numbers with tostring, but I need them as a Vector. Am I doing something wrong?

EDIT: Nevermind, found out that the numbers returned are in a table. Just did Vector(hitPos[1], hitPos[2], hitPos[3]) to convert to a Vector. Thanks for the help though :smiley:

Fixed the wiki, the function returns a vector.