Need help about gui making

Im very new at scripting. I know this is a very easy one but I cant fix this.

Im making a tablet. There is buttons on tablet. When we click to a specific button , other buttons must disappear but they are not disappearing.

here is code :

How can I fix this?

You cannot use game.StarterGui, instead use this:

local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")

-- PlayerGui.ScreenGui.Frame.Visible = false

Hope this helps!

1 Like

Where do I put first 2 lines? To start or finish?

At the very start of the code.

Is this right?

Instead of defining the PlayerGui, you may provide it with Parent. Because anyhow they are the descendants of PlayerGui.

And also you don’t need to write the button locations one by one. You can use the for loop and check if it is a text button. It will make them invisible.

script.Parent.MouseButton1Click:Connect(function()
    for i, descendants in pairs(script.Parent.Parent:GetChildren()) do
        if descendants:IsA("TextButton") then
            descendants.Visible = false
        end
    end
end)
1 Like

Güzel ama bu starterGui içindeki tüm hepsini kapamaz mı?

1 Like

I defined the text buttons location where they are. You may try inserting another text button and parent it to ScreenGui only. The script will detect the text buttons which are inside TabletFrame.

Alright. Thanks for help but I think first solution will be better for me.

1 Like