Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Changed SoundId function help?

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.