#Trying to make text hover when the mouse is pointing at a specific target

6 messages · Page 1 of 1 (latest)

arctic karma
#

Hello, i have a local script that is trying to make a ui follow the mouse and become visible when the players mouse hovers over a specific part

#
-- Services
local Players = game:GetService("Players")

-- Player Vars
local Player = Players.LocalPlayer

-- UI Vars
local PlayerGUI = Player:WaitForChild("PlayerGui")
local Gameplay = PlayerGUI:WaitForChild("Gameplay")
local HoverUI = Gameplay:WaitForChild("HoverUI")
local Main = HoverUI:WaitForChild("Main")
local Class = Main:WaitForChild("Class")
local Habitable = Main:WaitForChild("Habitable")
local Subclass = Main:WaitForChild("Subclass")

-- Input Vars
local Mouse = Player:GetMouse()

-- Funcs
local function GetTarget()
    if Mouse.Target then
        if Mouse.Target.Name then
            if Mouse.Target.Name == "Planet" then
                local Planet = Mouse.Target
                
                Main.Visible = true
                Main.Position = UDim2.fromScale(Mouse.X, Mouse.Y)
            elseif Mouse.Target.Name == "Ring" then
                local Planet = Mouse.Target.Parent
                
                Main.Visible = true
                Main.Position = UDim2.fromScale(Mouse.X, Mouse.Y)
            end
        end
    else
        HoverUI.Visible = false
    end
end

Mouse.Move:Connect(GetTarget)
nocturne burrow
#

Can you send your error logs?

arctic karma
nocturne burrow
#

Is anything happening?

twin owl
#

studio** You are now Level 4! **studio