So I have this LocalScript that makes a BillboardGUI appear on a part when the mouse hovers over it.
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
UIS.InputChanged:Connect(function(input)
if mouse.Target then
if mouse.Target:FindFirstChild("Rarity") then
if mouse.Target:FindFirstChild("Show") then
mouse.Target.BillboardGui.Enabled = true
else
mouse.Target.BillboardGui.Enabled = false
end
end
end
end)
How would I make it so the BillboardGUI vanishes when it’s no longer being hovered over? (By the client)
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
UIS.InputChanged:Connect(function(input)
if mouse.Target then
if mouse.Target:FindFirstChild("Rarity") then
if mouse.Target:FindFirstChild("Show") then
mouse.Target.BillboardGui.Enabled = true
repeat task.wait() until (mouse.Target:FindFirstChild("Show") == nil)
mouse.Target.BillboardGui.Enabled = false
end
end
end
end)
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
UIS.InputChanged:Connect(function(input)
if mouse.Target then
if mouse.Target:FindFirstChild("Rarity") then
if mouse.Target:FindFirstChild("Show") then
mouse.Target.BillboardGui.Enabled = true
local targ = mouse.Target.BillboardGui
repeat task.wait() until (mouse.Target ~= targ)
targ.Enabled = false
end
end
end
end)
Oh wow, this worked, but there’s a problem, the BbGUI only goes away if the mouse isn’t on another part with the Show value, because there are multiple parts with the Show value. Sorry.
Yeah I could see it but next time I recommend just using YouTube to upload an unlisted video.
Anyways.
Maybe this code works better:
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
UIS.InputChanged:Connect(function(input)
if mouse.Target then
if mouse.Target:FindFirstChild("Rarity") then
if mouse.Target:FindFirstChild("Show") then
mouse.Target.BillboardGui.Enabled = true
local targ = mouse.Target
repeat task.wait() until (mouse.Target ~= targ)
targ.BillboardGui.Enabled = false
end
end
end
end)