I have a folder with a list of player names and buttons, and I want to detect when and which one is clicked. However, when I attempt to print out the button, nothing seems to happen. Here is my code:

local ScrollingFrame = Players.LocalPlayer:WaitForChild("PlayerGui").Cashier.partyFrame.ScrollingFrame 
local PlayerNames = ScrollingFrame.PlayerNames -- this accesses the folder

for i,v in ipairs(PlayerNames:GetChildren()) do
	v.MouseButton1Click:Connect(function()
        print(v.Name)
	end)
end