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

How to make sounds to be specific to users? Welcome Gui involved

Asked by
xxCHLOE 10
9 years ago

Basically I have a game that I want to use a sound in

I want it to start playing whenever the user joins the game but want to end it when they click "Start" in a welcome Gui.

I want it to loop until the user clicks "Start", too, and am currently using this simple code to play it and loop it:

while true do
script.Parent:Play()
wait(98)
end

How would I go about the modifications that I desire, as seen above?

2 answers

Log in to vote
0
Answered by 9 years ago
script.Parent.Looped = true
script.Parent:Play()
Button.MouseButton1Click:connect(function()
    script.Parent:Remove()
end)

Ad
Log in to vote
2
Answered by 9 years ago
local ButtonClicked = false

Button.MouseButton1Click:connect(function()
ButtonClicked = true
end)

repeat script.Parent:Play() until ButtonClicked == true
0
That is an infinite loop and crashes when you run it. The audio is 98 seconds long, and I want it to loop until the button is pressed. Your code prevents it from working entirely. xxCHLOE 10 — 9y
0
then do repeat wait() script.Parent:Play() until ButtonClicked = true, But you have to aid the Button Value to the button. xImmortalChaos 565 — 9y
0
that doesn't work, and constantly keeps re-starting the audio now. and when you close it, the audio continues to play, but stops re-starting. xxCHLOE 10 — 9y

Answer this question