When the mouse is clicking on a Part, how to see on wich Part he's clicking I want to know like:
print(Mouse.???.Name)
When the mouse is clicking on a Part, how to see on wich Part he's clicking I want to know like:
print(Mouse.???.Name)
This is a localscript in the StarterPlayerScripts and is an example only.
local mouse = game.Players.LocalPlayer:GetMouse() -- get the players mouse
local part = nil -- this will store our part when clicked
mouse.Button1Up:connect(function()
part = mouse.Target -- this is so the value will not change as its not given to us in the event
if part then -- nil check
print(part) -- could also include name
end
end)
Hope this helps.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Target