0
\$\begingroup\$

I want to create a GUI where, when I click a button, an emote display pops up, and when I click an emote, it closes.

Currently, my display won't even show when the button is clicked. This is my code, can anyone help me?

local button = game.StarterGui.ScreenGui.EmoteButton.TextButton
local emoteDisplay = game.StarterGui.ScreenGui.EmoteDisplay
local emoteDisplayButtons = emoteDisplay.Emotes:GetChildren()


button.MouseButton1Click:Connect(function()
    print("Emote Button clicked.")
    emoteDisplay.Visible = true
    for emote in emoteDisplayButtons do
        emote.MouseButton1Click:Connect(function()
            print(emote.Name + "Button clicked")
            emoteDisplay.Visible = false
        end)
    end
end)
\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

You’re referencing StarterGUI, when you should be referencing each player’s UI; every player gets a copy of startergui when they join the game that they can interact with, and this script affects the originial (which cannot be interacted with).

I would add a localscript to the UI button that references it through parent, that should make it work.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .