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

Changed SoundId function help?

Asked by
NotSoNorm 777 Moderation Voter
10 years ago

So I am trying to make it so when the songId changes it does the function, I just added the "SoundId" part and it broke, Why?

script.Parent.ScrollingFrame.Sound.SoundId.Changed:connect(function(change)
        script.Parent.ScrollingFrame.Visible = false
        script.Parent.ScrollingFrame.Active = false
        script.Parent.SongPlayNoter.Visible = true
        wait(125)
        script.Parent.SongPlayNoter.Visible = false
        script.Parent.ScrollingFrame.Active = true
        script.Parent.ScrollingFrame.Visible = true
end)

1 answer

Log in to vote
0
Answered by 10 years ago

SoundId is a property and thus doesn't have the Changed event. I understand you're confusion, but the Changed event is in the object not the SoundId property, and it will tell you what the property is so you can check it if you create an if statement.

-- More on the changed event -- http://wiki.roblox.com/index.php?title=Changed_(Event)/property

This should fix it:

script.Parent.ScrollingFrame.Sound.Changed:connect(function(change)
    if change=='SoundId' then
            script.Parent.ScrollingFrame.Visible = false
            script.Parent.ScrollingFrame.Active = false
            script.Parent.SongPlayNoter.Visible = true
            wait(125)
            script.Parent.SongPlayNoter.Visible = false
            script.Parent.ScrollingFrame.Active = true
            script.Parent.ScrollingFrame.Visible = true
    end
end)

Please vote up if this fixed it/helped you

Ad

Answer this question