I am trying to make rotate something according to the surface of the part the mouse clicks, but I have no idea what output it gives! I have tried both strings and values but I end up having it print "Error". Anyone who can help me?
local surf = mouse.TargetSurface if surf == "0" then print("Right") elseif surf == "1" then print("Top") elseif surf == "2" then print("Back") elseif surf == "3" then print("Left") elseif surf == "4" then print("Bottom") elseif surf == "5" then print("Front") else print("Error") end
The mouse.TargetSurface
property returns a NormalId
Enum, which has 6 Enums:
Right (0), Top (1), Back (2), Left (3), Bottom (4), and Front (5)
When you want to see what surface that the property returns, either compare it to the Enum, the number, or the string. Here are examples of each:
ENUM
local Surface = mouse.TargetSurface if Surface == Enum.NormalId.Front then print("Front") end
NUMBER
local Surface = mouse.TargetSurface if Surface == 5 then print("Front") end
STRING
local Surface = mouse.TargetSurface if Surface == "Front" then print("Front") end
Hope this helped!