To sum it up, I have a folder that stores all the mobs in my game and I want to make it so when a player hovers over the mob it displays their health, and when they stop it stops displaying their health through a GUI.

I've used Mouse.Target and got the basic part which is displaying the UI. However upon me stopping to hover over it, it still has the UI.

Here's my script:

function ishovering(target)
	if mouse.Target:IsA("BasePart") and mouse.Target.Parent:FindFirstChild("Humanoid") then
		healthmod.Setup(mouse.Target.Parent, true)
	else
		print("not a npc")
	end
end