Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 1 year ago

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

Log in to vote
0
Answered by 1 year ago

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
Ad

Answer this question