Using MouseEnter, if the player moves their mouse through the button to fast the MouseLeave function wont fire, is there a way to fix this?
Could you show us the code please?
Desc.MouseEnter:Connect(function()
Desc:TweenSize(
UDim2.new(0, 85,0, 70),
"Out",
"Quad",
.3,
true
)
local data = game.MarketplaceService:GetProductInfo(Desc.Parent.ImportantValues.AssetId.Value, Enum.InfoType.Asset)
Player.PlayerGui.Main.ButtonInfo.Info.ItemName.Text = data.Name
Player.PlayerGui.Main.ButtonInfo.Info.Type.Text = Desc.Parent.ImportantValues.AssetType.Value
print(data.IconImageAssetId)
local assetId = Desc.Parent.ImportantValues.AssetId.Value
Player.PlayerGui.Main.ButtonInfo.Icon.Image = "rbxthumb://type=Asset&id=" .. assetId .. "&w=420&h=420"
Player.PlayerGui.Main.ButtonInfo.Info.Bucks.Amount.Text = data.PriceInRobux * 2
if game.UserInputService.TouchEnabled == false then
runService.RenderStepped:Connect(function()
Player.PlayerGui.Main.ButtonInfo.Position = UDim2.new(0, Mouse.X + 20, 0, Mouse.Y)
end)
else
Player.PlayerGui.Main.ButtonInfo.Position = UDim2.new(0, Mouse.X + 20, 0, Mouse.Y)
end
if game.UserInputService.TouchEnabled == true then
Player.PlayerGui.Main.ButtonInfo.Position = UDim2.new(0, Mouse.X + 20, 0, Mouse.Y)
end
Player.PlayerGui.Main.ButtonInfo.Visible = true
end)
Desc.MouseLeave:Connect(function()
Desc:TweenSize(
UDim2.new(0, 75,0, 60),
"Out",
"Quad",
.3,
true
)
Player.PlayerGui.Main.ButtonInfo.Visible = false
end)
The button is on a billboard GUI
Maybe have the MouseEnter and MouseLeave as a simple function that does nothing more than the tweens.
Use MouseEnter to trigger the rest of the script in another function.
Put MouseLeave in the same fold as MouseHover