Hello, I am making a game and I wanna put background music which only can be played at a loading GUI, this GUI can be called ‘‘the main GUI’’ I guess, there’s the option for ‘‘play’’,‘‘load out’’, and ‘‘credits’’. There’s 7 audios to be played and I had trying to figure out of to code this and I don’t get how to do it .I asked my friends who know about coding and didn’t know how to do it. I am a beginner coding but I mostly build, please answer me if you know how to do this.
I don’t exactly know what you’re trying to say, but if you mean playing an audio when you press a button you’d need to put the audios either in SoundService or in the UI itself, then define it in a LocalScript inside the TextButton. After defining it, add “(Name you defined it as):Play()”.
For example,
local Sound = script.Parent.Parent.ClickNoise1 -- Route to where your sound is located, change "ClickNoise1" to the name of your audio.
script.Parent.MouseButton1Click:Connect(function() -- When you click your mouse,
Sound:Play() -- Play this sound.
If you still need help, send a a picture of your explorer showing where your buttons and audios are and I’ll provide the code for you.
If this is not what you want to achieve, please provide more details.
I mean like, when the loading gui ends, the main gui should pop up, alright.
Now, when the main gui pops up I want it to actually be playing without a click, like automatically, btw thanks for the help! I will also use it!
You don’t even need to provide any events as it will run in a linear fashion.
Simply doing the following will work:
LoadingFrame:TweenPosition(UDim2.new(position here), "Out", "Linear", 1) --This tweens the position to your desired location
Sound:Play()
Let’s say you want it to play midway through the tween:
LoadingFrame:TweenPosition(UDim2.new(position here), "Out", "Linear", 1) --The 1 represents the duration
wait(0.5) --We will wait half the amount of time it takes for the frame to tween
Sound:Play()
There are many things you can do Don’t overthink it!!
Use what @ijmod said,
Though you’ll also need to configure the wait()
variables to match your loading screen.
For example, if your loading screen takes 5 seconds to finish then you’ll need to add wait(5)
before the tween script.
Hope we could help you!
Alright, by the way would you be interested on being dev of the game? as a GUI designer and scripter? I might pay too! We are a really small team with my friends and we need some help…
No sorry, I have personal projects to work on.
Also if we helped, please mark one of our responses as the solution!