Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i make a Hover script without the Hand Cursor?

Asked by 8 years ago
function Hover()
    print("Hovered")
end

script.Parent.MouseHoverEnter:connect(Hover)

This does not work because MouseHoverEnter is not a member of Part. How can i fix it without a ClickDetectors Hand Cursor?

1 answer

Log in to vote
3
Answered by 8 years ago

Use Mouse.Target, this says the part which the mouse is on and you can see if the Target is a certain part and if it is than it will do something.


Mouse.Target

This is a property that you cannot change.

print(Mouse.Target) --Will print the name of the part you were first touching.

Mouse.TargetFilter

Will make Mouse.Target ignore some parts.

Mouse.TargetFilter = workspace.Part
print(Mouse.Target) --Should ignore part and say another part, or maybe say nil.


Final Product

--Local Script
local plyr = game:GetService("Players").LocalPlayer
local mouse = plyr:GetMouse()
local part = workspace.Part --The part you want to do the action with.

mouse.Move:connect(function()
    if mouse.Target == part then
        print("Hover")
    end
end)

You can incorporate a remote event/function into this so the part would print "Hover" instead of the local script.



Hope it helps!

0
Good answer, and well explained ghosteffectz 115 — 8y
0
you're new, aren't you... HungryJaffer 1246 — 8y
Ad

Answer this question