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

Why is this breaking?

I'm a very "noobish" scripter, What am I doing wrong?

while true do
	wait(0.5)
if script.Parent.ScrollingFrame.Sound.IsPlaying = true
		then script.Parent.ScrollingFrame.Visible = false
		then script.Parent.SongPlayNoter.Visible = true
elseif script.Parent.ScrollingFrame.Sound.IsPlayer = false
		then script.Parent.ScrollingFrame.Visible = true
		then script.Parent.SongPlayNoter.Visible = false
	end
end

4 answers

while true do
    wait(0.5)
    local isPlaying = script.Parent.ScrollingFrame.Sound.IsPlaying
    script.Parent.ScrollingFrame.Visible = not isPlaying
    script.Parent.SongPlayNoter.Visible = isPlaying
end

Your script itself had two main errors; you were using "=" for comparison instead of "==", and you were indexing "isPlayer" in the second if statement.

while true do
    wait(0.5)
if script.Parent.ScrollingFrame.Sound.IsPlaying == true then
        script.Parent.ScrollingFrame.Visible = false
        script.Parent.SongPlayNoter.Visible = true
elseif script.Parent.ScrollingFrame.Sound.IsPlayer == false then
        script.Parent.ScrollingFrame.Visible = true
        script.Parent.SongPlayNoter.Visible = false
    end
end

Just change where you put the "Then"

3 comments

0

That says its wrong ;o?

0

Oh! You have to do == so it checks if the sound is playing

0

Oh :P

Error at line 3 and line 7.

I wasn't sure where the end's were supposed to go, so II assumed they go in these places.

while wait(0.5) do
if script.Parent.ScrollingFrame.Sound:Play() then
script.Parent.ScrollingFrame.Visible = false
script.Parent.SongPlayNoter.Visible = true
elseif not script.Parent.ScrollingFrame.Sound:Play()then
script.Parent.ScrollingFrame.Visible = true
script.Parent.SongPlayNoter.Visible = false
end end

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