[GUI] Nickname Popup over Mouse Hover Problem!

Hey there!

I made a script that can show player’s display name once mouse hovered them, but i dont want it to show my own name, because game is designed to be first person and this happens:


(Local player’s name isnt supposed to be on screen)

here’s the script:

--General--
local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Plr = Players.LocalPlayer
local PlrMouse = Players.LocalPlayer:GetMouse()
local Frame = script.Parent
local UI = Frame.PlrName
local Cam = workspace.CurrentCamera
local wt = 0.25
--Tweens--
local Tween = game:GetService("TweenService")
local Info = TweenInfo.new(wt)
local PT1 = Tween:Create(Frame, Info, {BackgroundTransparency = 0.5})
local PT2 = Tween:Create(UI, Info, {TextTransparency = 0})

PlrMouse.Move:Connect(function()
	local CamPos = Cam.CFrame.Position
	local Dir = CFrame.new(CamPos, PlrMouse.Hit.Position)
	local Target = workspace:Raycast(CamPos,Dir.LookVector*8)

	if Target then
		local ActualTarget = Target.Instance.Parent
	if not ActualTarget:FindFirstChildOfClass("Humanoid") then
			ActualTarget = ActualTarget.Parent
	if not ActualTarget:FindFirstChildOfClass("Humanoid") then
			ActualTarget = nil
		end
	end
		
	if ActualTarget then
		local Player = Players:GetPlayerFromCharacter(ActualTarget)
	if Player then
            wait(0.01)
            PT1:Play()
	    PT2:Play() 
	    UI.Text = Player.DisplayName
	    Frame.Position = UDim2.new(0,PlrMouse.X,0,PlrMouse.Y)
        end
	else
--UI Gone
	else
--UI Gone
	end
end)

If you have any knowledge on how to solve it i’d appreciate that!

Just add, to that if statement if Player, and do if Player and Player ~= Plr. Should work!

RIGHT!!
LMAO ITS 2 AM FOR ME RN AND MY LAST BRAINCELL JUST WENT TO BUY SOME MILK.
me dummy tried to use if not lol.
Thanks!

No worries, happens to us all. Just remember next time that a break is more valuable then whatever work you’re getting done in the middle of the night. Lel.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.