function onButtonClicked()
Children = script.Parent.Parent:GetChildren()
for i = 1, #Children do
if Children[i]:IsA("ImageButton") then
Children[i]:Destroy()
end
script.Parent.MouseButton1Down:connect(onButtonClicked)
I'm trying to make it remove ImageButtons If a player clicks it

2 comments
You forgot to add the 'end''s for the 'for' loop and 'if' statement.
^ exactly. use the output to find out what is wrong: http://wiki.roblox.com/index.php?title=Output