Ive looked everywhere for a fix, Cant seem to find anything, And anything i do find seems to not work, Anyways once i move my mouse off of the button it is still connected to my mouse meaning it thinks im still hovering over the gui, If you have any suggestions please reply.
Can you provide the code you use to detect if the mouse leave the gui?
Desc.MouseEnter:Connect(function()
local clone = hovertemp:clone()
clone.Visible = true
local assetinfo = MarketPlaceService:GetProductInfo(Desc.Parent.ImportantValues.AssetId.Value)
local assetname = assetinfo.Name
if Desc.Parent.ImportantValues.AssetType.Value == "Gamepass" then
local Asset = MarketPlaceService:GetProductInfo(Desc.Parent.ImportantValues.AssetId.Value, Enum.InfoType.GamePass)
clone.Icon.Image = "rbxassetid://"..Asset.IconImageAssetId
clone.Info.ItemName.Text = Asset.Name
clone.Info.Type.Text = Desc.Parent.ImportantValues.AssetType.Value
elseif Desc.Parent.ImportantValues.AssetType.Value == "Clothing" then
clone.Icon.Image = "https://www.roblox.com/asset-thumbnail/image?assetId="..Desc.Parent.ImportantValues.AssetId.Value.."&width=420&height=420&format=png"
clone.Info.ItemName.Text = assetname
clone.Info.Type.Text = getassettypefromid(assetinfo.AssetTypeId)
end
clone.Parent = game.Players.LocalPlayer.PlayerGui:WaitForChild("hovertemp")
local runservice = nil
Desc.MouseLeave:Connect(function()
if clone then
clone:Destroy()
end
if runservice then
runservice:Disconnect()
end
end)
runservice = game:GetService("RunService").RenderStepped:Connect(function()
local v28 = game:GetService("UserInputService"):GetMouseLocation();
clone.Position = UDim2.new(0, v28.X, 0, v28.Y);
end);
end)
The problem here, I would say is that the connection is not getting disconnected after the mouse leaves, the function is all fine, this is a common error, disconnecting a runservice connection might sometimes not work, I have faced this. A great fix to this issue would be adding a variable and using UserInputService.InputChanged instead of RunService. When the mouse enters, you set the variable to true and when it leaves, you set it to false. In the InputChanged function you should check if the variable is true, if it is true then you set the clone position.
1 Like
Thanks, I didnt do exactly what u said, But something came to my head after reading your suggestion, Thanks again!
1 Like