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

Is there a way to determine which face of a part the mouse is hovering over?

Asked by
Kurieita 125
7 years ago

For instance, my mouse.

If I hover over the back of the part, I should be able to determine it is the back. Any suggestions?

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
7 years ago

PlayerMouse.TargetSurface is exactly what you want!

--LocalScript

local mouse = game.Players.LocalPlayer:GetMouse()

mouse.Move:connect(function()
    if mouse.Target then
        print(mouse.TargetSurface.Name)
    end
end

If you're not used to working with EnumItems, there is a page for them on the wiki as well.

Ad

Answer this question