How to get Mouse.Target on mouse click?
What I am trying to do here is when a tool is equipped and left click is clicked, if the cursor is aiming at fixp, zwire, rwire or gwire, some parts' transparencies should change. This is a localscript and i put it in the tool which is supposed to be equipped:
02 | local tool = script.Parent |
03 | local fixwire = game.Workspace.bluewirefix |
04 | local fixp = game.Workspace.fixp |
05 | local Player = game:GetService( "Players" ).LocalPlayer |
06 | local Mouse = Player:GetMouse() |
07 | local Target = Mouse.Target |
08 | local zwire = game.Workspace.zwire |
09 | local gwire = game.Workspace.gwire |
10 | local rwire = game.Workspace.rwire |
13 | tool.Equipped:Connect( function (Mouse) |
15 | Mouse.Button 1 Down:Connect( function () |
17 | if Target = = fixp or Target = = zwire or Target = = gwire or Target = = rwire then |
19 | zwire.Transparency = 1 |
20 | fixwire.Transparency = 0 |
No errors in output are shown. What am I doing wrong? ;-;