#Goal:# I'm trying to create a shop tooltip to display information of an item in a shop.
#Setup:# It takes information by name of the item. The main code is in a Local Script in a ScreenGui. The information is saved on ReplicatedStorage (module script).
#Problem:# I had 1 item and it worked fine. After I try adding another item it started glitching and malfunctioning. It started to have duplicates or only display one specific text. Also, I have to start with the fireball in order for it to work a bit.
Evidence: https://gyazo.com/5f3d473abf8869660b02d7c31d95d914.gif https://gyazo.com/71d08655a24b0b3b021b1659159bd095.gif
#Script:# This is the Script that detect Mouse Enter and Mouse Move:
--// TOOL TIP SHOP \\ --
local ShopShowToolTipSizeX = ShopToolTip.Size.X.Offset
spawn(function()
for _, item in pairs(Shop:GetChildren()) do
if item:IsA('ImageButton') then
item.MouseEnter:Wait()
ShopToolTip.Visible = true
ShopToolTip.ItemName.Text = 'Name: '..item.Name
ShopToolTip:WaitForChild('ItemDesc').Text = 'Desc: '..MovesInfo[item.Name].Desc
ShopToolTip.ItemDamage.Text = 'Dmg: '..MovesInfo[item.Name].Damage
ShopToolTip.ItemPrice.Text = 'B$ '..MovesInfo[item.Name].Cost
item.MouseMoved:Connect(function(X, Y)
ShopToolTip.Position = UDim2.new(0, (X - ShopShowToolTipSizeX) - 10, 0, Y)
ShopToolTip.Visible = true
item.MouseLeave:Wait()
ShopToolTip.Visible = false
Shop.MouseLeave:Wait()
ShopToolTip.Visible = false
end)
end
end
end)
Any support and feedback that improves this code or fixes the problem are appreciated. Thank you for reading.
