So I have a lot of itemjs in my game they all have the same script I have hundreds of them so I thougth what better way to do this then collection service but then it came to my mind thats thats not going to work because it gets duplicated into the player this is the script.
local collectionService = game:GetService("CollectionService")
for _, textLabels in collectionService("AmountItemShowerTag") do
local amountItemShower = script.Parent
local amountItem = script.Parent.Parent.AmountItem
local item = script.Parent.Parent
item.Visible = false
if amountItem >= 1 then
item.Visible = true
amountItemShower.Text = amountItem.Value.."x"
end
amountItemShower.Text = amountItem.Value.."x"
amountItem:GetPropertyChangedSignal("Value"):Connect(function()
if amountItem >= 1 then
amountItemShower.Text = amountItem.Value.."x"
else
item.Visible = false
end
end)
end
Can anyone please help me with a better way for this?