Is it me or does MouseEnter not function anymore

For some odd reason, MouseEnter doesn’t work while in a local script, yet it functions in a module. For example:
I have a custom leaderboard which is controlled by a local script. Everything functions fine but the color tweening. I have another custom leaderboard which is in a module, there is a local script which refreshes the playerlist for it to work, yet the MouseEnter actually works on that.

My tween script.

	TouchFrame.MouseEnter:Connect(function()
		print("Mouse entered")
		Tween:Create(NameHolder, TweenInfo.new(0.2), {TextColor3 = Color3.fromRGB(80, 80, 255)}):Play()
		Tween:Create(ValueHolder, TweenInfo.new(0.2), {TextColor3 = Color3.fromRGB(80, 80, 255)}):Play()
	end)
	
	TouchFrame.MouseLeave:Connect(function()
		print("Mouse left")
		Tween:Create(NameHolder, TweenInfo.new(0.2), {TextColor3 = Color3.fromRGB(255, 255, 255)}):Play()
		Tween:Create(ValueHolder, TweenInfo.new(0.2), {TextColor3 = Color3.fromRGB(255, 255, 255)}):Play()
		
	end)

UI is meant to light up purple and both are originally white text

Local script

image

Module script

image

MouseEnter, MouseLeave are very broken events. If anything create a custom Mouse Enter-Leave
It requires knowledge of basic math.

Checking weather the mouse X and mouse Y is bigger the topLeft of the button. But lower in the bottom right. From there you can tell if its inside or not.

local isInButton = false

Mouse.Move:Connect(function()
   local topLeft = button.Position + button.Size    
   local bottomRight = button.Position - button.Size

   if Mouse.X > topLeft.X and Mouse.Y > topLeft.Y then
       if mouse.X < bottomRight.X and mouse.Y < bottomRight.X then
           if isInButton then return end
           isInButton = true

           print("isInButton")
      end
   end
end

Thats just a rough example. Most likely wont work. But it’s an draft/pseudo of the idea I am talking about.

1 Like

Yes I understand. Thank you very much. I would report it as a bug but I’m pretty sure Roblox knows about this.

If you needed someone to help you understand how to actually reproduce something like this event wise. Just hit me up on discord. You already have me on discord.

1 Like