Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Why isn't my toggle GUI button script working with imagelabels but works with everything else?

Asked by 3 months ago

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?

my script:

button.MouseButton1Click:Connect(function()
    game.StarterGui.Frames.Backpack.Visible = true

my workspace: https://gyazo.com/3582f8e3c09febf9a9f498752a2abaad

0
Is that all of your code? popeeyy 448 — 3mo
0
no, its just the mouseubtton1click part 1swenzje 27 — 3mo

1 answer

Log in to vote
0
Answered by
incapaxx 3252 Badge of Merit Moderation Voter Community Moderator
3 months ago

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

Ad

Answer this question