Mouse Hover Usertag Issue

I’m currently working on something that where if your mouse hovers over a player, it shows their nametag, rank, etc.

I’ve been looking through the devforum, and no one has really answered this question, and each thing I see, doesn’t really work.

I’m using an extremely simple script, and I’ve just layed out the framework, but it doesn’t seem to be working. When I hover over a HumanoidRootPart, it prints that it’s a HumanoidRootPart, but it doesn’t print get pass the if statement.

local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse() 
local FindHumanoid = Mouse.Target.Parent:FindFirstChild("Humanoid")


Mouse.Move:connect(function() 
	print(Mouse.Target)
	if Mouse.Target == "HumanoidRootPart" or FindHumanoid then 
		print("Found Human")
        --Other code to show nametag
	end 
	
end)

I’m not sure why it’s not working. If anyone could give some insight onto why this isn’t working, that’d be great.

I’m not really sure about this, but mouse.target probably returns the instance so maybe you should try
if Mouse.Target.Name == "HumanoidRootPart" or FindHumanoid then ?

2 Likes

:man_facepalming: Welp. That was stupid of me not to think of that.