Make audio when click button

it is local not server sideeee

Try this:

local startb = PlayerGui.LocalScript.Menu.TextButton
local song1 = Instance.new("Sound",script)
song1.SoundId = "rbxassetid://6927468309"

startb.Activated:Connect(function()
    print("Click")
    wait(1)
    song1:Play()
end)

If click is printed, add this line below like this:

song1.SoundId = "rbxassetid://6927468309"
if not song1.IsLoaded then 				song1.Loaded:Wait()					end

click was print int output but no sound

Question: Is “Menu” a ScreenGui?

Yes it goes a local script then the child is a menu

check if the sound instance is inside the script (or wherever the sound is parented) when button is clicked. If there is, check the properties of it if anything is nil (if the volume is low, or if the sound id is not there etc.)

Maybe you need to set the parent of the sound?

the sound is in the script not a pyshical sound object

Could you please check if a normal audio plays for you? (I mean putting a random audio in the workspace and ticking the “playing” property)
Maybe your Roblox volume is muted or idk.

ill just make it a sound part to play instead, thanks everyone bye

I tested it and it works for me what

local startb = script.Parent.TextButton

local song1 = Instance.new("Sound",script)

song1.SoundId = "rbxassetid://6927468309"

startb.Activated:Connect(function()

print("Click")

wait(1)

song1:Play()

end)

Yea, it works for me too. That’s the reason why i asked about his volume.

I have other scwripts that might interfear so its more then what it looks like

I have other scripts that might interfere so its more then what it looks like

Can you maybe take a screenshot of your workspace as it makes it a whole lot easier to visualize where things are?

everyone its okay ill figure it out another way thanks hto bye

Instead of creating a sound using the script how about create a sound inside a script:

local startb = script.Parent.Parent.StarterGui.LocalScript.Menu.TextButton
local song1 = script.Sound 
startb.Activated:Connect(function()
wait(5)
song1:Play()
end)

Maybe do something like this:
image

1 Like

Hmm, can you tell me more about the problem? I can try helping you with it

You are referring to StarterGui whilst you should be referring to playerGui.

Do

local startb = script.Parent.LocalScript.Menu.TextButton

StarterGui is the place holder for all the GUI , each Player has a PlayerGui which gets the GUI from StarterGui . So to make changes to a Player’s UIs you should always refer to PlayerGui object inside the Player.

you don’t need to access playergui, al the gui made will be cloned to client’s playergui