How to check the position of your click?

So for my game I simply need to find the position on a object that I clicked. Here’s an example.

I need a script that checks the pos that you clicked, and then the script prints the pos.

I will not show a script here because I do not have any idea how to make any part of this script.

Sorry for the low amount of information, I’m new to scripting and devforums.

Check this:

1 Like

OK, I’ll check it out! Hope it works.

Mouse.p gets you the position. Make sure you define “Player.”

local mouse = Player:GetMouse()
print(mouse.p)
1 Like

Is this correct?

local Player = game.Players.LocalPlayer

local Mouse = Player:GetMouse()

print(Mouse.p)

because there is an error.

p is not a valid member of PlayerMouse "Instance"

Mouse.Hit.Position is what you need to use, they forgot to mention the Hit property

1 Like

Thanks! This works really well!

1 Like

Wait, but how do I convert that to the position on a 3d object? because that’s printing the position on the screen.

Mouse.Hit.Position prints the position in 3D space

image

I’m not sure what you mean by converting to a 3d object position

Oh, imma check again. maybe I didn’t check if it worked properly.

Oh sorry! I wasn’t testing it properly. My bad!

1 Like