Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I get Mouse.Hit.p, but for a part?

If the title doesn't explain it properly, if I have the Vector2 position of a part and if the mouse was at the same Vector2 position as the part, then Mouse.Hit.p would be the answer. I hope you see what I mean.

1 answer

You can use Mouse.Target to check if the player's mouse is pointing at a specific part.

while task.wait() do
	if Mouse.Target == TargetPart then -- TargetPart is a BasePart in the workspace
		print("Player's Mouse has found the TargetPart. Mouse Position: (" .. Mouse.Hit.Position .. ") TargetPart Position: (" .. Mouse.Target.Position .. ")")
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.