I am making a script that make music play when you enter the game... I want the script to make the music stop when you press the begin (gui button). But when i test the game the music stop 1.5 seconds after i join the "test" game.
Here is the script:(local script i put inside the gui button)
local OpenSound = Instance.new("Sound", game.Workspace)
local begin = script.Parent
OpenSound.SoundId = "rbxassetid://1837482907"
wait(0.5)
OpenSound:Play()
wait(1)
repeat
wait(1)
if begin.MouseButton1Click:connect()
then OpenSound:Stop()
else wait(1)
end
until OpenSound:Stop() == true

4 comments
Second parameter to the Instance.new() is deprecated, you should use OpenSound.Parent = workspace instead.
thanks so much i don't understand your script but thanks :P
@ AswormeDorijan111 I already seted the parent of sound - ("Sound" - name of variable, workspace --- parent of the sound) Instance.new(stringval, instance parent)
yes but HaveASip, the parent parameter of Instance.new() is decaperated, it makes a difference look at this: https://gyazo.com/3cc3fb697653a893156d40282f66cfca