#How to make that when pressing on GUI sound will start playing

1 messages · Page 1 of 1 (latest)

south iris
#

paste the script here

outer basin
#

k

#

`local button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local soundsFolder = ReplicatedStorage:WaitForChild("Sounds")

button.MouseButton1Click:Connect(function()
local template = soundsFolder:FindFirstChild("Netherlands")
if template then
local sound = template:Clone()
sound.Parent = workspace
sound:Play()
sound.Ended:Connect(function()
sound:Destroy()
end)
else
warn("Sound 'Netherlands' not found in Sounds folder.")
end
end)
`

south iris
#

maybe because you set the sound's parent to workspace and not to the button?

outer basin
#

do i have to move my sound in button?

south iris
#

yea because you are setting the sound's pattern to the workspace and not the button

outer basin
#

ok 1 sec

south iris
#

sound.Parent = button

outer basin
#

`local button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local soundsFolder = ReplicatedStorage:WaitForChild("Sounds")

button.MouseButton1Click:Connect(function()
local template = soundsFolder:FindFirstChild("Netherlands")
if template then
local sound = template:Clone()
sound.Parent = button.Netherlands
sound:Play()
sound.Ended:Connect(function()
sound:Destroy()
end)
else
warn("Sound 'Netherlands' not found in Sounds folder.")
end
end)`

#

still didnt work

south iris
#

nono

#

not button.Netherlands

#

just button

outer basin
#

k

south iris
#

since you are already setting the button in "button = script.Parent"

outer basin
#

ughh it still doesnt work

south iris
#

does output say anything

#

@outer basin

outer basin
#

idk not really

#

let me send it

south iris
#

does the warn show

outer basin
outer basin
#

local soundsFolder = ReplicatedStorage:WaitForChild("Sounds") its like this

#

there was sounds

#

but i moved 1 sound that i needed

#

in button

#

does it have to do something?

south iris
#

why not just putting the sound inside the button and when m1 happens it just plays?

worthy ironBOT
#

studio** You are now Level 9! **studio

outer basin
#

why not just putting the sound inside the button and when m1 happens it just plays?
and how should i do that?

#

its not part btw its on gui

south iris
#

lemme test something

south iris
outer basin
#

btw thanks for helping

south iris
#

@outer basin

#

js fixed it

outer basin
#

im here

#

how should it be?

south iris
#

script.Parent.MouseButton1Click:Connect(function()

local sound = script.Sound:Clone()
sound.Parent = script.Parent.Parent.Parent

sound:Play()

if sound.Ended == true then

    sound:Destroy()

end

end)

#

there

outer basin
#

@south iris it still doesnt work

#

i mean i changed some things

#

my text button is in Scrolling Gui

#

so it needs four parents yes?

#

OH WAIT

#

IT WORKED

#

LOL

south iris
outer basin
#

TYSM

south iris
#

np

outer basin
#

life saverr

#

i swear

#

i've been trying for hours

south iris
#

if you need anything lmk

outer basin
#

lol

south iris
outer basin
#

tysm again

outer basin
#

@south iris how to make that when 1 button is pressed its playing, but as soon as other button will get pressed first pressed button will stop functioning and other pressed button will start functioning

#

bit hard but idk how to do it

south iris
#

Give me a sec and i help you

outer basin
#

im definetly giving u credit

outer basin
#

Btw if something ping me

#

I won’t receive messages here

agile dove
outer basin
#

Theres 1 part. On that part theres surfacegui, in surface gui theres many text buttons. I mace that when you press button (for example france text button) song will start playing. But i want to make that when france music is being played and when i press other button, france music will stop playing and other pressed button music will start playing

agile dove
#

Seems simple enough

#

Can u send me a picture of ur explorer

outer basin
#

@agile dove

#

sound under script is all same in other textButtons

#

just names changed

#

to country

#

for example: Netherlands TextButton, Sound is called Netherlands too

agile dove
#

k

#

I can give u a script tomorrow, because it’s past midnight for me rn and I’m not on my pc currently

outer basin
#

okay

#

i've to sleep now too

agile dove
outer basin
#

oh i already did it :DD

#

@agile dove

#

but can u help me with 1 thing?

agile dove
#

Wdym

#

Make I look high quality?

outer basin
#

no like that

agile dove
#

First of all did u set lightning to realistic

outer basin
#

oh-

#

its like this

worthy ironBOT
#

studio** You are now Level 11! **studio

agile dove
#

wym

outer basin
#

how to set to realistic

#

do u mean future?

outer basin
agile dove
outer basin
#

can u tell me how to make it

agile dove
agile dove
outer basin
#

i dont have realistic there-

agile dove
outer basin
#

future shadow voxel

agile dove
#

future is best

outer basin
#

i have that

#

chosen already

agile dove
#

good

outer basin
#

and wdym by tweens?

agile dove
#

tweenservice

outer basin
#

idk that one 😭

#

i mean i heard but never used it

#

will it make it better?

agile dove
#

probably

outer basin
#

--[[
The parts in the Target Folder must contain numbered parts to maintain order
The numbering must start from 1
The parts need to be named in the order that they are in, for example if it's the first part then it will be named 1
]]--

local Left = script.Parent.Left -- The folder with the parts
local LeftElements = Left:GetChildren() -- The table of the parts

local EmptyGridColor = Color3.new(0, 0, 0) -- Color of the emptys (obviously)
local TargetColor = Color3.new(1, 0, 0) -- Color of the center or segments

local BodyLength = 5 -- Length of the body
local HalfLength = math.floor(BodyLength/2)

while true do
for i = 1, #LeftElements + BodyLength do -- << reversed direction (from top to bottom)

    -- Clear colors
    for i = 1, #LeftElements do
        Left[i].Color = EmptyGridColor
    end

    local Center = i - HalfLength

    -- Below center
    for j = Center - HalfLength, Center do
        local Segment = Left:FindFirstChild(tostring(j))
        if not Segment then continue end
        Segment.Color = EmptyGridColor:Lerp(TargetColor, j / (Center - HalfLength))
    end

    -- Above center
    for j = Center, Center + HalfLength do
        local Segment = Left:FindFirstChild(tostring(j))
        if not Segment then continue end
        Segment.Color = TargetColor:Lerp(EmptyGridColor, j / (Center + HalfLength))
    end

    -- Center segment
    local CenterSegment = Left:FindFirstChild(tostring(Center))
    if CenterSegment then
        CenterSegment.Color = TargetColor
    end

    task.wait(0.07)
end

task.wait()

end

#

this is script im using

#

for that

#

but it looks so cheap compared to that video

agile dove
#

did u make this code?

outer basin
#

Me and my friend