I need replace which part with script.Parent.ExitButton? Because atm its still doing the same thing
Have you tried what I posted earlier?
Yes, It didnt play and also broke the play button again.
Yes, here is an example:
My gui:
In this case, ExitButtom would be Close:
local Sound = Instance.new("Sound",script)
Sound.SoundId = "rbxassetid://" .. 0
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
Sound:Play()
end)
local ExitButtom = script.Parent.Parent.Close
ExitButtom.MouseButton1Click:Connect(function()
Sound:Stop()
end)
Have you inserted the sound id into the script?
Yes, It still held the same results.
Wait, you want a play button to make a frame visible and play a sound?
No, clicking the play button is supposed to make the music stop.
It would be Play, right?
local Sound = Instance.new("Sound",script)
Sound.SoundId = "rbxassetid://" .. 0
Sound:Play()
Sound.Looped = true
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
Sound:Stop()
end)
Since it doesn’t have a button to start the sound, it is placed outside of Connect for it to play.
(Add Looped so it doesn’t stop.)
Alright! Check this.
--// Variables //--
local Button = script.Parent
local Frame = script.Parent.Parent
local Sound = script.Parent.Parent:WaitForChild("Sound")
Sound.SoundId = "rbxassetid://" .. ID
--// Functions //--
Button.MouseButton1Click:Connect(function()
Frame.Visible = false
Sound:Stop()
end)
Yes, this worked, thank you so much!
You’re welcome, happy to help ^ - ^
Ah, this worked too, I’d mark you as solution but SOTR654’s worked and she posted hers first, I still very much appreciate your help.