I want to make a script where if i click a face of a part it would tell me the face i clicked on. so if i click on the top face it would print "top", if i clicked the front face it would say "front" ect.
code snippet
tool.Equipped:Connect(function(mouse) mouse.Button1Down:Connect(function() if mouse.Target and mouse.Target.Parent then print("face") end end) end)
Mouse.TargetSurface
gives you a NormalId
value which tells you the surface the mouse is on. When it is in the sky, it defaults to Right
, so make sure you check if Mouse.Target
is existent.
https://developer.roblox.com/api-reference/property/Mouse/TargetSurface