This is my code.. How do I make the billboard GUI show up when I hover over the part? Also how do I make it not be half inside the part its parented to?
local computerScreen = game.Workspace.ComputerScreen local CursorId = "2287179355" local ClickDetector = Instance.new("ClickDetector") ClickDetector.Parent = computerScreen ClickDetector.MaxActivationDistance = 10 ClickDetector.CursorIcon = "rbxassetid://"..CursorId local openGUI = Instance.new("BillboardGui") openGUI.Parent = computerScreen openGUI.Name = "OpenComputer" openGUI.MaxDistance = 10 openGUI.Size = UDim2.new{1,0},{1,0} openGUI.ExtentsOffset = Vector3.new(0,2,0) openGUI.Enabled = false local openText = Instance.new("TextLabel") openText.Parent = computerScreen.OpenComputer openText.Size = UDim2.new(28) openText.Font = 10 openText.Text = "Open" openText.Visible = false ClickDetector.MouseHoverEnter:Connect(function() openGUI.Enabled = true openText.Visible = true print("Done") end) ClickDetector.MouseHoverLeave:Connect(function() openGUI.Enabled = false openText.Visible = false print("Done Left") end)
You mostly had it, but there are a few things to note here.
local computerScreen = game.Workspace:WaitForChild("ComputerScreen") local CursorId = "2287179355" local ClickDetector = Instance.new("ClickDetector") ClickDetector.MaxActivationDistance = 10 ClickDetector.CursorIcon = "rbxassetid://"..CursorId -- Parent after you're done setting properties ClickDetector.Parent = computerScreen local openGUI = Instance.new("BillboardGui") -- AlwaysOnTop puts GUI on top of everything. openGUI.AlwaysOnTop = true openGUI.Name = "OpenComputer" -- Set Adornee to computerScreen openGUI.Adornee = computerScreen openGUI.MaxDistance = 10 -- Don't use brackets openGUI.Size = UDim2.new(1,0,1,0) openGUI.ExtentsOffset = Vector3.new(0,2,0) -- Parent after you're done setting properties openGUI.Parent = computerScreen local openText = Instance.new("TextLabel") -- FontSize 7 = 24 openText.FontSize = 7 -- Set Size of TextLabel openText.Size = UDim2.new(1,0,1,0) openText.Font = 10 openText.Text = "Open" openText.Visible = false -- Parent after you're done setting properties openText.Parent = computerScreen.OpenComputer ClickDetector.MouseHoverEnter:Connect(function() openText.Visible = true print("Done") end) ClickDetector.MouseHoverLeave:Connect(function() openText.Visible = false print("Done Left") end)
Add a ClickDetector into the part and then insert this into the part:
ClickDetect = script.Parent.ClickDetector Billboard = script.Parent.BillboardGui --make sure to add a BillboardGui with a TextLabel in it in the part. --And add a ClickDetector in the part, too. Billboard.TextLabel.Visible = false ClickDetect.MouseHoverEnter:connect(function() Billboard.TextLabel.Visible = true end)
If you want to make it disappear when exit, put what's above in with the following:
ClickDetect.MouseHoverLeave:connect(function() Billboard.TextLabel.Visible = false end)