My GUI does not pop up when I hover over a part

I want to achieve a system where if I hover over a specific part or object a health GUI is shown near the bottom of the players screen, as shown in the image

The issue is that when I hover over the part, The highlight and part name show up but not the HealthGUI of the Part

I have tried already looking on the developer hub and Ive tried different ways of trying to get the GuI to appear this just has me confused

-- local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local StarterGUI = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Collection = game:GetService("CollectionService")

mouse.Move:Connect(function()

	if not mouse.Target then script.Highlight.Adornee = nil return end --Highlights

	if Collection:HasTag(mouse.Target, "Highlitable") then
	script.Highlight.Adornee = mouse.Target
	return
elseif Collection:HasTag(mouse.Target.Parent, "Highlitable") then
	script.Highlight.Adornee = mouse.Target.Parent
	return
end

script.Highlight.Adornee = nil -- Unhighlights

end)

--Health Popup

local part = game.Workspace.Rock2
local ClickDetector = part.ClickDetector


ClickDetector.MouseHoverEnter:Connect(function()
	game.StarterGui.MineGUI.RockHealth.Visible = true
	print("entered")
end)

ClickDetector.MouseHoverLeave:Connect(function()
	print("Left")
end)
1 Like

For the player you need to access the PlayerGui not StarterGui.

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