No I haven't tried anything just asking a QUESTION can you use MouseEnter and MouseLeave on a physical part like in some games when you mouse over something and trigger a gui...
All I wanted to know
As an alternative to ClickDetectors, you can use a combination of an event, UserInputService.InputChanged
, and the Mouse.Target
property:
local uis = game:GetService("UserInputService") local Mouse = game:GetService("Players"):GetMouse() local lastObject uis.InputChanged:connect(function() if lastObject ~= Mouse.Target then if lastObject then --MouseLeaveFunction(lastObject) end if Mouse.Target then --MouseEnterFunction(Mouse.Target) end lastObject = Mouse.Target end end)
InputChanged
fires when the Mouse moves or scrolls, or wherever a mouse&keyboard input doesn't have a definite 'on' or 'off' state (such as a Key being pressed or not).
Yes, with ClickDetectors
.
ClickDetectors have 2 events similar to MouseEnter and MouseLeave:
MouseHoverEnter
MouseHoverLeave
You use these events just like how you would use the MouseEnter and MouseLeave event in Gui objects.
Read more about ClickDetectors here: ClickDetectors
Hope this helped!