Object Label

local UIS = game:GetService("UserInputService")

local player = game.Players.LocalPlayer

local mouse = player:GetMouse()


local label = player.PlayerGui:WaitForChild("NameGUI")


UIS.InputChanged:Connect(function(input)

if mouse.Target then

if mouse.Target:FindFirstChild("Label") then

player.PlayerGui.NameGUI.Enabled = true

player.PlayerGui.NameGUI.Adornee = mouse.Target

if mouse.Target.Parent and mouse.Target.Parent ~= game.Workspace then

player.PlayerGui.NameGUI.TextLabel.Text = mouse.Target.Parent.Name

else

player.PlayerGui.NameGUI.TextLabel.Text = mouse.Target.Name

end

else

player.PlayerGui.NameGUI.Enabled = false

player.PlayerGui.NameGUI.Adornee = nil

player.PlayerGui.NameGUI.TextLabel.Text = ""

end

end

end)