ClickDetector MouseHoverEnter with Tool Equipped

  1. What do you want to achieve? I want to print something when my mouse is over a part with clickdetector and a with a tool equipped

  2. What is the issue? when i equip a tool and i try to do the previous thing that i said, nothing happens

  3. What solutions have you tried so far? i tried with Player:GetMouse() and FindFirstChild(“Pointer”)

you can have 2 conditions, if the tool is equipped AND if the mouse is hovering over it then the function runs!

Hello, I think you should use ClickDetector | Roblox Creator Documentation and Tool | Roblox Creator Documentation

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

local ToolName "YourToolName" -- Put your Tool Name
local UserInputService = game:GetService("UserInputService")

UserInputService.InputChanged:Connect(function(input, engine_processed)
    if engine_processed then
        return
    end

    if input.UserInputType == Enum.UserInputType.MouseMovement then
        if Mouse.Target:IsA("Part") and Mouse.Target:FindFirstChild("ClickDetector") and Player.Character:FindFirstChild(ToolName) then
          print("Player's Mouse is Over a part which has a Click detector and Tool equipped.")
       end
    end
end)

Make Sure the ClickDetector is Named “ClickDetector
and This should be a LocalScript in StarterPlayerStarterCharacterScripts

local ClickDetector = workspace.Part.ClickDetector

ClickDetector.MouseHoverEvent:Connect(function(player)
	if player.Character:FindFirstChild("ToolName") and player.Character["ToolName"]:IsA("Tool") then
		print("yes")
	end
end)

Sorry for being very late but tysm!

1 Like