when i try to script a "toggle gui" button that is supposed to toggle an image label when pressed, it doesnt work. when i tried using an image button it worked so why isn't the script working with imagelabels?
button.MouseButton1Click:Connect(function() game.StarterGui.Frames.Backpack.Visible = true
my workspace: https://gyazo.com/3582f8e3c09febf9a9f498752a2abaad
Because ImageButtons are buttons. They are able to be interacted with and they can show a picture whereas an ImageLabel is just to show a picture. In addition, the StarterGui is not where the player's Gui is, it is in their PlayerGui.
local client = game:GetService("Players").LocalPlayer button.Activated:Connect(function() client.PlayerGui.Frames.Backpack.Visible = true end)
I gave an explanation on the difference which you are able to find here