#How to make sound starts playing when GUI is clicked

1 messages · Page 1 of 1 (latest)

plain halo
static atlas
#

Clicker.MouseClick:Connect(onclick)

plain halo
#

I’ll try as soon as i get home

lilac geyser
#

are u using clickdetectors for the ui?

plain halo
#

Yes

lilac geyser
plain halo
#

No

#

No I don’t

#

I just checked

lilac geyser
#

Oh

plain halo
static atlas
#

why is it a clickdetector

#

where the thing you click is clearly a button

plain halo
#

I dont have click detection

#

this is what it looks like

#

oh wait-

#

what should i do then?

#

@static atlas

static atlas
#

you cant do it with a script

#

you need remotes

#

ok look

plain halo
#

then how can i do it?

#

OMG NOT THE REMOTES PLEASE- I LITERALLY SUCK AT IT

#

i mean i suck at scripts too

static atlas
#

add something like this

plain halo
#

but remotes is harder for me

plain halo
static atlas
#

and this here

plain halo
#

what has to be inside Music?

#

my audios?

static atlas
#

the script

#

now add a local script to the button

#

wait no actually

#

hold on

plain halo
#

okay

static atlas
#

yeah add a local script to where all the buttons are

#

not in the button

plain halo
#

in ScrollingGUI

#

or surfaceGUI?

#

its like this

static atlas
#

yes

#

for i, v in script.Parent:GetChildren() do
if v:IsA("TextButton") then
v.Activated:Connect(function()
game.ReplicatedStorage:FindFirstChild("music"):FireServer(v:FindFirstChildWhichIsA("Sound"))
end)
end
end

#

and this in the local

plain halo
#

also i have few audios

static atlas
plain halo
#

where can i put them?

static atlas
#

the audios you put in the buttons

plain halo
#

i want like 18 songs to play when its clicked and i just dont understand it ://

static atlas
#

check output

plain halo
#

im there

#

it doesnt red anything connected to this

static atlas
#

is the event named Music or music

plain halo
#

Music

static atlas
#
for i, v in script.Parent:GetChildren() do
    if v:IsA("TextButton") or v:IsA("ImageButton") then
        v.Activated:Connect(function()
            warn("SHOULD PLAY MUSIC")
            game.ReplicatedStorage:FindFirstChild("music"):FireServer(v:FindFirstChildWhichIsA("Sound"))
        end)
    end
end
``` try this
#

and check output