Hi! I’ve been trying to get this button to go through for a while and I just can’t get it to work. It currently has prints everywhere and none of them get printed.
Any ideas?
for i,v in pairs(DispatchMF.Dashboard.Calls.Holder:GetChildren()) do
if not v:IsA("UIListLayout") then
v.delete.MouseButton1Click:Connect(function()
print("DeleteClicked")
local callname = v.Name
print("CallName Varred")
Functions.RemoveCall(callname)
print("SentFunction")
end)
end
end
May I see the hierarchy of the DispatchMF.Dashboard.Calls.Holder?
The clean code here: no functional changes
for _, v in pairs(DispatchMF.Dashboard.Calls.Holder:GetChildren()) do
if not v:IsA("UIListLayout") then
v.delete.MouseButton1Click:Connect(function()
Functions.RemoveCall(v.Name)
end
end
end
for _, v in pairs(DispatchMF.Dashboard.Calls.Holder:GetChildren()) do
local button = v:FindFirstChildWhichIsA("GuiButton")
if button then
button.MouseButton1Click:Connect(function()
Functions.RemoveCall(v.Name)
end)
end
end
I forgot to ask you about what the intended functionality of the button is. Functions.RemoveCall(v.Name) is a mystery to me. Can you forward the function?
I think you should add another function to the DispatchMF.Dashboard.Calls.Holder hooked to the ChildAdded listener. Because the buttons would otherwise be left non-functional.
DispatchMF.Dashboard.Calls.Holder.ChildAdded:Connect(function(child)
local button = child:FindFirstChild("delete")
if button then
button.MouseButton1Click:Connect(function()
Functions.RemoveCall(child.Name)
end)
end
end