So whenever I pick up an Item, I can’t hover over the item.
how would I update the :GetChildren() to check if there’s
a new Item which is inside the Holder?
The issue is, whenever I hover over the New Item it doesn’t show the information I want from print()
I tried adding a while wait(1) do which isn’t even good, but still didn’t work.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Fruits = require(ReplicatedStorage:WaitForChild("Fruits"))
local Holder = script.Parent
for Name, Fruit in pairs(Fruits) do
for _,v in pairs(Holder:GetChildren()) do
if v:IsA("ImageLabel") then
v.MouseEnter:connect(function()
print("Showing "..Name.." Worth: "..Fruit.Details.Cost)
end)
v.MouseLeave:connect(function()
print("Left "..Name)
end)
end
end
end
Okay so I tried doing this, and it seems to be doing good.
but now the thing is, I get this error which I’m not sure why and how to fix it at all
[13:31:09.178 - Players.BosOfroblox.PlayerGui.UI.Inventory.Holder.ShowDetails:10: attempt to index upvalue ‘Fruit’ (a nil value)
[13:31:09.911 - Players.BosOfroblox.PlayerGui.UI.Inventory.Holder.ShowDetails:14: attempt to concatenate upvalue ‘Name’ (a nil value)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Fruits = require(ReplicatedStorage:WaitForChild("Fruits"))
local Holder = script.Parent
local function NewItemAdded(v, Name, Fruit)
if v:IsA("ImageLabel") then
v.MouseEnter:connect(function()
print("Showing "..Name.." Worth: "..Fruit.Details.Cost)
end)
v.MouseLeave:connect(function()
print("Left "..Name)
end)
end
end
for Name, Fruit in pairs(Fruits) do
for _,v in pairs(Holder:GetChildren()) do
NewItemAdded(v, Name, Fruit)
end
end
Holder.ChildAdded:connect(NewItemAdded)
I tried printing v.Name and I got this when I hit the new Added Item: Nil
Thanks, I’ve played around with it and it seemed to be working
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Fruits = require(ReplicatedStorage:WaitForChild("Fruits"))
local Holder = script.Parent
local function NewItemAdded(v)
for Name, Fruit in pairs(Fruits) do
if v:IsA("ImageLabel") then
v.MouseEnter:connect(function()
if v.Name == Name then
print("Showing "..Name.." Worth: "..Fruit.Details.Cost)
end
end)
v.MouseLeave:connect(function()
print("Left "..Name)
end)
end
end
end
for _,v in pairs(Holder:GetChildren()) do
NewItemAdded(v)
end
Holder.ChildAdded:connect(NewItemAdded)