Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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!

2 comments

0

Good answer, and well explained

0

you're new, aren't you...

This discussion is preserved as it was. New answers, comments, and votes are closed.