Hello! I have a Text Button Inside of a billboard GUI in my game, and I use Mouse Enter and the Mouse Leave functions to detect the mouse, but when the player moves their mouse over the button at a fast speed, the Mouse Leave function wont fire, but everything in the mouse enter function does, is there a way to prevent this?
My code (In starterplayerscripts):
function ButtonInfo(Desc)
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.MouseEnter:Connect(function()
Desc:TweenSize(
UDim2.new(0, 85,0, 70),
"Out",
"Quad",
.3,
true
)
ButtonInfo(Desc)
Desc.MouseLeave:Connect(function()
Desc:TweenSize(
UDim2.new(0, 75,0, 60),
"Out",
"Quad",
.3,
true
)
Player.PlayerGui.Main.ButtonInfo.Visible = false
end)
end)
-- The function
function ButtonInfo(Desc)
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