Mouse Enter function stop working when equip Tool

Hi, i’m making a system that when your mouse enter the button the selectionbox be visible, but when i equip some tool the selectionbox don’t be visible and the script doesn’t recognize it

I think the problem is with my tool and not with my script but idk what to do

Here are some images

Without the tool equipped: (Working)
Screenshot_2

With the tool equipped: (Not Working)
Screenshot_3

If someone know something will help a lot

Sorry for bad english

This is the code i tried:

local rs = game:GetService("ReplicatedStorage")
local UIS = game:GetService("UserInputService")
local runservice = game:GetService("RunService")
local remote = rs.Coisas.abrecoisa
local evento = rs.Coisas.plau

local function ligar(sele)

	sele.Transparency = 0

end

local function desligar(sele)

	sele.Transparency = 1

end

local plr = game.Players.LocalPlayer
local m = plr:GetMouse()

local function ishovering(part)
	if part ~= nil and m.Target ~= nil then
		if m.Target == part then
			return true
		else
			return false
		end
	end
end


local col = game:GetService("CollectionService")

local ret = col:GetTagged("botao")
local port = col:GetTagged("porta")

for _, portas in pairs(port) do
	
	if portas:FindFirstChild("SelectionBox") then
		
		local sele = portas:FindFirstChild("SelectionBox")

		runservice.RenderStepped:Connect(function()

			if ishovering(portas) == true then

				evento:Fire("aparece", "porta")
				ligar(sele)  --Makes selection Box Visible

			elseif ishovering(portas) == false then

				evento:Fire("fecha", "porta")
				desligar(sele)  --Makes selection Box Invisible

			end

		end)
		
	end
	
end

Actually i’m not using “Mouse Enter” function but i got the same results

Is your tool overriding your mouse inputs and all that? I’m able to use mouse.Target while holding a tool just fine

(this is what i’m using to do that)

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

while wait() do
	print(mouse.Target)
end

thanks, the problem is on tool script with TargetFilter

No problem, and can you mark it as a solution then