I need it to remove the gui from the brick when the mouse is removed. Any help?
player = game.Players.LocalPlayer
mouse = player:GetMouse()
mouse.Move:connect(function()
if mouse.Target ~=nil and mouse.Target.Name == 'HoverBrick' then
script.Parent.Position = UDim2.new(0,mouse.X,0,mouse.Y)
end
end)

2 comments
Here are some tips: 1. Please don't use global variables, put Local before the 'player =' and 'mouse ='. And please use formatting for the script so it's easier for us.
There is a property in mouse called "Icon". This is what makes the mouse visible. This is like an asset value. Like the ones in Decal.Texture