How can I set the cframe of a part to the same direction of my mouse click?

Say I stored the position of my mouse click when I fireserver a remote event like RemoteEvent:FireServer(Mouse.Hit) , how can I set the cframe of a part to the direction of that mouseclick?

You are not firing the position of the mouse because you forgot the .p after Hit, it must be Mouse.Hit.p

You would have to give it Mouse.Hit.p and then in that remote event’s code, just do this

(name of your part).Position = MousePosition

Where (name of your part) is the location of your part from the explorer and MousePosition is the parameter for the position of your mouse when you fire the event

Well when I store it as a parameter server side, i can just use direction.p

Okay doing some quick research, you actually can just give it the Hit property as a parameter I believe since it’s a CFrame, then you would just do what I said but replace .Position with .CFrame, I believe that would work

What do you mean by hit property?

The Hit property of the mouse, Mouse.Hit as you did it. It’s a CFrame so it should be able to be sent from Client to server

But you need the other parameter after Mouse.Hit

Well i tried doing part.Cframe = Direction.p and it returns " invalid argument #3 (CFrame expected, got Vector3)"

Remove the .p, it turns the CFrame into a Vector3, which si the wrong type

Mouse.Hit.p is needed if he want to get the position of the mouse.

So I did it and there no errors however the part is no where to be found. How do I make it so that it’s a considerable distance away from my character in the desired direction and it can still be seen?

@OP specifically mentioned he wanted CFrame, if CFrame is needed, .p is not needed, all .p does is convert a CFrame to the positional Vector3 it points to, and Mouse.Hit already returns a CFrame

Wait what do you mean? Also, were you clicking in the air by any chance?

when clicking in the air, the .Hit will be thousands of studs away

Edit: wrong reply sorry i meant to reply to @Deathlios

Yup I was, I want it so that when i click whereever, the part would appear a certain amount of studs away ffrom me in that same direction.