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

Button Script Does not execute when clicked. Any fixes? [CLOSED]

Asked by
RAYAN1565 691 Moderation Voter
6 years ago
Edited 6 years ago

I am trying to get this script to work but it is not for some reason. I cannot find the problem... Please see the script below:

local Button = script.Parent
function Clicked()
    local Frame = script.Parent.Parent.Parent 
    local a = script.Parent.Parent.AudioIDInsert.Text
    local b = script.Parent.Parent.Parent.Parent.MusicForPlayers
        wait(0.1)
            b:Pause()
                b.Volume = 1
                wait(0.1)
                    b.SoundId="http://www.roblox.com/asset/?id=" .. a
                wait(0.1)
             b:Play()
        wait(0.1)
    Frame:Destroy()
end
Button.MouseButton1Click:connect(Clicked)

Thanks to all those who are making an attempt to help.

1
It looks like the sound is parented inside the frame? Wait for the sound to finish playing with `b.IsPlaying` before destroying. MooMooThalahlah 421 — 6y
1
I have fixed the script. Thanks for the suggestion! RAYAN1565 691 — 6y

1 answer

Log in to vote
1
Answered by 5 years ago

It looks like the sound is parented inside the frame? Wait for the sound to finish playing with b.IsPlaying before destroying.

Ad

Answer this question