#how to make that when i press textButton other textButtons will appear?

1 messages · Page 1 of 1 (latest)

plush lake
#

I've got SurfaceGUI on part and inside that part there are textbuttons, i can't think of script that will solve this problem. there are 3 main buttons (Semi Final 1, Semi Final 2 and Grand Final). i want to make something like this: when i press Semi Final 1 textbuttons will appear (not all, ones i want), when i press Semi Final 2 - other textbuttons will appear etc.

jovial pier
#

would smth like this work (customiseable)

#

local surfaceGui = script.Parent

-- References to main buttons
local semiFinal1Button = surfaceGui.MainButtons.SemiFinal1Button
local semiFinal2Button = surfaceGui.MainButtons.SemiFinal2Button
local grandFinalButton = surfaceGui.MainButtons.GrandFinalButton

-- References to frames with respective buttons
local semiFinal1Frame = surfaceGui.SemiFinal1Frame
local semiFinal2Frame = surfaceGui.SemiFinal2Frame
local grandFinalFrame = surfaceGui.GrandFinalFrame

-- Helper function to hide all frames
local function hideAllFrames()
semiFinal1Frame.Visible = false
semiFinal2Frame.Visible = false
grandFinalFrame.Visible = false
end

-- Button connections
semiFinal1Button.MouseButton1Click:Connect(function()
hideAllFrames()
semiFinal1Frame.Visible = true
end)

semiFinal2Button.MouseButton1Click:Connect(function()
hideAllFrames()
semiFinal2Frame.Visible = true
end)

grandFinalButton.MouseButton1Click:Connect(function()
hideAllFrames()
grandFinalFrame.Visible = true
end)

-- Optionally hide all frames on start
hideAllFrames()

plush lake
#

OMG TYSM

#

aw it didnt work

jovial pier
#

srry im not that good at scripting also new

plush lake
#

Np

#

Still thank you

jovial pier
#

there might b like specific names to change bc idk if i got the names right

plush lake
#

but do you know how to change color when mouse is at the text button in ScrollingGUI

jovial pier
#

you mean like hovering over it?

plush lake
#

script has to be where?

plush lake
jovial pier
#

no i dont srry

#

aska i

#

even th its awful

plush lake
#

Nvm

jovial pier
#

lol sry

hidden steppeBOT
#

studio** You are now Level 1! **studio

jovial pier
#

local surfaceGui = script.Parent in the surface gui

plush lake
#

Omgg why it doesn’t worki

#

Work*

jovial pier
#

change the names in the scipt? ie. grandFinalFrame like u might not have something called that>

plush lake
#

What does main button mean here?

#

Nvm

#

@jovial pier what is frame here?

#

SemiFinal1Frame

jovial pier
#

wdym

plush lake
#

I mean I don’t have anything like SemiFinal1Frame or semifinal2frame, but it doesn’t red it, so what is that for?

#

local semiFinal1Frame = surfaceGui.SemiFinal1Frame local semiFinal2Frame = surfaceGui.SemiFinal2Frame local grandFinalFrame = surfaceGui.GrandFinalFrame this part

jovial pier
#

those are the variables for the frames. Idk why it doesnt error for those but if you change the last bit after the surface GUi. to the name of ur actual buttons that are inside the surfacegui

#

and then under each press make the ones you want visible, visible semiFinal1Button.MouseButton1Click:Connect(function()
hideAllFrames()
semiFinal1Frame.Visible = true
end)

#

change semiFinal1Frame.Visible = true

plush lake
#

`local surfaceGui = script.Parent

-- References to main buttons
local semiFinal1Button = surfaceGui.SemiFinal1Button
local semiFinal2Button = surfaceGui.SemiFinal2Button
local grandFinalButton = surfaceGui.GrandFinalButton

-- References to frames with respective buttons
local semiFinal1Frame = surfaceGui.SemiFinal1Frame
local semiFinal2Frame = surfaceGui.SemiFinal2Frame
local grandFinalFrame = surfaceGui.GrandFinalFrame

-- Helper function to hide all frames
local function hideAllFrames()
semiFinal1Frame.Visible = false
semiFinal2Frame.Visible = false
grandFinalFrame.Visible = false
end

-- Button connections
semiFinal1Button.MouseButton1Click:Connect(function()
hideAllFrames()
semiFinal1Frame.Visible = true
end)

semiFinal2Button.MouseButton1Click:Connect(function()
hideAllFrames()
semiFinal2Frame.Visible = true
end)

grandFinalButton.MouseButton1Click:Connect(function()
hideAllFrames()
grandFinalFrame.Visible = true
end)

-- Optionally hide all frames on start
hideAllFrames()` its like this rn. all i changed was button names in script it was main button.SemiFinal1 Button and i deleted MainButtons

jovial pier
#

ok

#

send me a pic of the layout of ur surface gui

#

like whats inside of it

#

in the exploreer

plush lake
jovial pier
#

which ones do you want visble when you press each

#

looks like ur doing it well tbf

plush lake
#

When i press semi final 1 i want visible to be: Albania, Azerbaijan, Belgium, Croatia, Cyprus, Estonia, Iceland, Italy, Netherlands.

Semi Final 2 (semi final 1 buttons will disappear) - Norway, Poland, Portugal, San Marino, Slovenia, Spain, Sweden, Switzerland, Ukraine

Grand final - “Coming Soon…”

jovial pier
#

under semiFinal1Button.MouseButton1Click:Connect(function() write surfaceGui.Albania.Visible = true surfaceGui.Belgium.Visible = true etc and write the others in semi final2 and grand final to false e.g. surfaceGui.Norway.Visible = false inside of semiFinal1Button.MouseButton1Click:Connect(function() but under semiFinal2Button.MouseButton1Click:Connect(function() do the opposite w grand final also not visible. and grand final turn everything to visible false apart from coming soon

hidden steppeBOT
#

studio** You are now Level 2! **studio

plush lake
#

let me tryy

jovial pier
#

it might take a while

#

theres probably faster ways to do it

plush lake
#

im a fast writer

jovial pier
#

but thats the way id do it lol

feral mantle
#

hi

plush lake
#

hi

feral mantle
#

let me try to help

plush lake
#

tyy

jovial pier
#

yeah im kinda new to developing ur prolly better xd

feral mantle
#

js gotta make smth sure

#

its ok I can make u understand it aswell

plush lake
#

tyy

#

its like my dream to make Eurovision game lol where ppl can perform

#

also events

feral mantle
#

so

#

when u press semi final 1

#

u want which ui's to be visible

plush lake
#

@jovial pier surfaceGui.Albania.Visible = true DO I have to write it under hideAllFrames()?

plush lake
#

this is their names

jovial pier
#

i dont think it matters

plush lake
feral mantle
#

ok wait

jovial pier
#

i dont think the frames are needed tbf

feral mantle
#

its easy

#

u just have to check when the button is clicked

plush lake
#

well i literally suck at scripting 😭

feral mantle
#

and then just turn invisible on or off

jovial pier
#

yeah thats what i thought

feral mantle
#

ok so lets say

#

as example

#

u press semi final 1

jovial pier
#

but that means you have to right out like 26 countries

#

visible nonvisible

feral mantle
#

yea

#

but also no

#

for that there is for loops

jovial pier
#

?

#

o

feral mantle
#

so u dont have to get EVERY text button

jovial pier
#

I haven't looked into loops like this b4

feral mantle
#

so

#

the scrolling frame

#

has children

#

and the children are textbutton

plush lake
#

yes, children are textButtons

jovial pier
#

so u mean like split into 3 folders find children that are textbuttons and make them visible/non-visible?

feral mantle
#

so what u do is for ,_ textbuttons in pairs(scrollingframe:GetChildren()) do
if textbuttons:IsA("TextButton") then
textbuttons.Visible = false

end

#

this will

#

make every textbutton inside scrolling frame invisible

#

and

#

if u want as example australia to be visible

jovial pier
#

yeah so if u split it into 3 folders one for each then you need each to have a loop to make all children visible/non-visible on press

feral mantle
#

u do under the textbutton.Visible = false
if textbuttons.Name == "Australia"
then textbuttons.Visible = true

#

end

#

wait let me do

jovial pier
#

makes sense

plush lake
#

not lying its literally first thing i understood in lua (not mentioning basic ones, like if, print..)

manic condor
#

This is like watching 2 babies talking to each other.

jovial pier
#

who bc theres 3 of us

manic condor
jovial pier
#

so yggdrasil

plush lake
#

@manic condor he knows scripting too

jovial pier
#

fairs

#

i dont know that much

plush lake
#

im the only one here who has no idea

jovial pier
#

i think he went

#

gl w ur eurovision game

plush lake
#

who went?

manic condor
plush lake
#

Yggdrasil said 'let me do it' so hes making it

plush lake
jovial pier
#

yggdrasil is smarter than us fair

plush lake
#

never said no

#

he is

jovial pier
#

i did say use ai bc we didnt have anyone smarter than us until yggdrasil came

feral mantle
#

anyway

#

this is how it should look like

#

for example

jovial pier
#

i think he was talking about me

feral mantle
#

I didnt do ur script I show an example

#

lemme clip wait

jovial pier
#

bc i said js ask ai as a last resort bc we didnt know what to do

feral mantle
#

well idk

#

I missunderstand then

#

if yes sorry

#

missunderstood?

#

idk

#

Im not english

plush lake
#

isnt that correct? 😭

#

it is ig

#

okay not importand

#

important*

manic condor
jovial pier
#

lol

feral mantle
#

ok ima send

#

this is just an example of what I mean

#

and also, u need a UiLayout inside ur scrollingFrame

#

I think you already do

#

the "Button" is ur semi1final

#

or idk semi2

plush lake
feral mantle
#

yes

#

so look

#

in this script

plush lake
#

thats exactly what i needed

feral mantle
#

the Button is "Semi1final"

plush lake
#

thank you so much

feral mantle
#

and when u press it

plush lake
#

i just have to change names and things for semi final 2 and grand final?

feral mantle
#

everything dissapears except australia

#

yes

#

u just have to add

#

and make 2 other functions

plush lake
#

THANK U SO SO MUCH

feral mantle
#

since this function is for smi1final only

#

js send me ur screengui smh

#

so I can make it for u quick

plush lake
#

aww really?

feral mantle
#

the rest u can make urself cuz then it will be just copy and paste and just rewrite names

#

ye

#

its easy lol

plush lake
#

did it work?

feral mantle
#

wait

#

so

#

u right click ur screengui

#

and then save from file

#

and then send

plush lake
#

thats what i did

feral mantle
#

hm

#

ok wait

plush lake
feral mantle
#

ok

#

it worke

#

let me do now

#

ok what ui's u want to be visible for semi1

#

and for semi2

#

and grand

plush lake
#

When i press semi final 1 i want visible to be: Albania, Azerbaijan, Belgium, Croatia, Cyprus, Estonia, Iceland, Italy, Netherlands.

Semi Final 2 (semi final 1 buttons will disappear) - Norway, Poland, Portugal, San Marino, Slovenia, Spain, Sweden, Switzerland, Ukraine

Grand final - “Coming Soon…” (coming soon bc i will add countries when there would be qualifying countries)

feral mantle
#

ok

#

done

plush lake
#

tyy

feral mantle
#

bruh

#

no

#

wait

#
local Gui = workspace:WaitForChild("EurovisionBoard").EurovisionGUI
local ScrollingFrame = Gui.ScrollingFrame
local ComingSoon = Gui["Coming Soon"]

--Buttons 
local SemiFinal1Button = Gui.SemiFinal1Button
local SemiFinal2Button = Gui.SemiFinal2Button
local GrandFinalButton = Gui.GrandFinalButton


-- Functions 

-- here you put the functions for each main button like Semi1 etc.. if u want to add any new main button put it in buttons and then do another function with the name of the button like im doing it here

local function SemiFinal1Pressed()
    ComingSoon.Visible = false
    for _, TextButtons in pairs(ScrollingFrame:GetChildren()) do
        local VisibleCountries =      TextButtons.Name == "Albania"  or TextButtons.Name == "Azerbaijan" or TextButtons.Name == "Belgium" or TextButtons.Name == "Croatia" or TextButtons.Name == "Cyprus" or TextButtons.Name == "Estonia" or TextButtons.Name == "Iceland" or TextButtons.Name == "Italy" or TextButtons.Name == "Netherlands" 
        if TextButtons:IsA("TextButton") then
            TextButtons.Visible = false
            if VisibleCountries then
                TextButtons.Visible = true
            end
        end
    end
end

local function SemiFinal2Pressed()
    ComingSoon.Visible = false
    for _, TextButtons in pairs(ScrollingFrame:GetChildren()) do
        local VisibleCountries =      TextButtons.Name == "Norway"  or TextButtons.Name == "Poland" or TextButtons.Name == "Portugal" or TextButtons.Name == "San Marino" or TextButtons.Name == "Slovenia" or TextButtons.Name == "Spain" or TextButtons.Name == "Sweden" or TextButtons.Name == "Switzerland" or TextButtons.Name == "Ukraine" 
        if TextButtons:IsA("TextButton") then
            TextButtons.Visible = false
            if VisibleCountries then
                TextButtons.Visible = true
            end
        end
    end
end


local function GrandFinalPressed()
    for _, TextButtons in pairs(ScrollingFrame:GetChildren()) do
        if TextButtons:IsA("TextButton") then
            TextButtons.Visible = false
            
        end
    end
    ComingSoon.Visible = true
end


-- Use the function when button is pressed
SemiFinal1Button.MouseButton1Click:Connect(SemiFinal1Pressed)
SemiFinal2Button.MouseButton1Click:Connect(SemiFinal2Pressed)
GrandFinalButton.MouseButton1Click:Connect(GrandFinalPressed)```
#

and here is the new one

#

wait

#

put the script inside startergui

plush lake
#

tysm

feral mantle
#

does it work?

plush lake
#

Checking

feral mantle
#

and put in script the euro thing parent

plush lake
#

YOU ARE LITERALLY LIFE SAVER

#

10/10

#

OMG

#

IT FINALLY WORKS

feral mantle
#

ok good

#

np

plush lake
#

It works is it still necessary?

#

@feral mantle sorry for bothering but i have 1 more questions, i mean how do i add more countries when there's no space left?

hidden steppeBOT
#

studio** You are now Level 10! **studio

jovial pier
#

im happy you got it working !

hidden steppeBOT
#

studio** You are now Level 3! **studio

feral mantle
#

well thats not a problem

#

u always have space

plush lake
feral mantle
#

u have infinite space

#

the thing is that u just have to add them

plush lake
#

i mean i cant scroll it

feral mantle
#

and make them visible in the script

#

and thats it

#

yes

#

u have to add the countries

plush lake
#

oh

#

let me do it 1 min

feral mantle
#

the scrolling frame has infinite space

#

its js bc of the uilistlayout

#

it shows only the uis that are visible

#

and makes a perfect fit

#

let me how

plush lake
#

i want to do in semi final 2, and in semi final 1, there is already semi final 1 songs

feral mantle
#

show*

#

oh nvm

#

u just have to change the canvas

plush lake
#

i did it

#

i understand it

#

I MEAN THANK YOU ISNT ENOUGH

#

THANK YOU SO SO SO MUCH

feral mantle
#

here

#

ye np bro

plush lake
#

i did it without scale

#

i just duplicated 1 textbutton changed names and just added it on Semi Final 2

feral mantle
#

oh ye

#

that works too

plush lake
#

@feral mantle i have uploaded audio's how to make that when i press that country name in Semi Final 1 song will start playing?

#

SORRY I KNOW IM MESSAGING TOO MUCH

feral mantle
#

it doesnt work bc uh

#

the script is inside workspace

#

right

#

and its a local script

#

thats wjy

#

why

#

it just doesnt

#

so u gotta do it in the main script

#

the main script is the script I just did for you

#

I mean you can make a sound handler with module script

plush lake
#

Script is inside surface gui or scrolling gui i don’t remember

feral mantle
#

startergui

manic condor
#

Flame this guy for being a spoonfeeder

plush lake
#

uhm