Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I put an audio into a loading screen then make it stop when the player clicks play? [closed]

Asked by 3 years ago

I have a screen that has the game logo and theres a "Play" button. How do I add music then make the music stop when the player clicks Play? Thanks!

Closed as Not Constructive by AntiWorldliness, JesseSong, youtubemasterWOW, Nguyenlegiahung, TaxesArentAwesome, and Fifkee

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
2
Answered by
Rinpix 639 Moderation Voter
3 years ago

You can just put a sound into a ScreenGui(or anywhere else in the PlayerGui but preferably in a ScreenGui for easier access).

Put this in a ScreenGui in a LocalScript. Make sure there's a sound in the ScreenGui as well as a TextButton.

local gui = script.Parent
local sound = gui:WaitForChild("Sound")
local button = gui:WaitForChild("TextButton")

sound:Play()

button.MouseButton1Click:Connect(function()
    sound:Stop()
end)
1
Thank you so much for the reply! I put a sound then that script in a local script but it's still the same as before. The audio plays and doesn't stop. Is there anything I should rename in that script? The Play is actually an ImageButton so I changed TextButton to ImageButton but it still wont work. Decimouse -4 — 3y
0
When you changed the text that says "TextButton", did you change it to the name of the ImageButton or just ImageButton? Or is the name already ImageButton? Rinpix 639 — 3y
0
The image button is named Play so I changed TextButton to Play. Decimouse -4 — 3y
0
You can just use my answer and edit somethings to your preference. https://scriptinghelpers.org/questions/102160/why-wont-my-while-music-looploop-again JesseSong 3916 — 3y
Ad