Hello all! I had a question on how to be able to pass specific arguments through this one line of code, since I have never done arguments this way. It is necessary to know the name of the instance, and I could not figure out any other way to be able to find it out. Thank you so much!!
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ClickAnimsScript = require(ReplicatedStorage.ButtonClickAnims)
local collectionService = game:GetService("CollectionService")
local connection = {}
local function clickButton(name)
warn(name)
game.ReplicatedStorage.DistributionCodes:FireServer("Claiming",name)
end
script.Parent.ChildAdded:Connect(function(instance)
warn(#collectionService:GetTagged("DistributionItems"))
warn(instance.Name)
connection[instance] = instance.MouseButton1Click:Connect(clickButton)
end)
script.Parent.ChildRemoved:Connect(function(instance)
if connection[instance] then
connection[instance]:Disconnect()
connection[instance] = nil
end
warn(#collectionService:GetTagged("DistributionItems"))
end)