for _, But in pairs(script.Parent.Frames.Frame:GetChildren())do
if But:IsA("TextButton")then
But.MouseButton1Click:Connect(function()
print("Inside FINALLYYYYYYYYY")
end)
end
end
I basically just want it to work when i click the button inside any frame
You have to either iterate through the descendants of the frame or create a second loop inside of the first loop.
for _, frame in pairs(script.Parent.Frames:GetChildren()) do
if frame:IsA("Frame") then
for _,button in pairs(frame:GetChildren()) do
button.MouseButton1Click:Connect(function()
print("Inside FINALLYYYYYYYYY")
end)
end
end
end
or
for _, button in pairs(script.Parent.Frames:GetDescendants()) do
if button:IsA("GuiButton") then
button.MouseButton1Click:Connect(function()
print("Inside FINALLYYYYYYYYY")
end)
end
end
No i mean like to if da player like clicked 2nd or 3rd frame and print it
for example if a player clicked the 3rd frame i want it to print(“player clicked 3rd frame”)