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

Why wont my music stopper work? (Unfinished answer!)

Asked by 10 years ago

the output keeps saying Workspace.Part.Script:13: 'then' expected near '=' and i dont understand it. and im wondering if this their is a more efficient way

if game.Workspace.Timber:IsPlaying() = true then 

game.Workspace.NewStyle:Stop()  

end

if game.Workspace.Timber:IsPlaying() = true then 

game.Workspace.Self:Stop()  

end
0
Same output is Workspace.Part.S1:12: attempt to call method 'IsPlaying' (a boolean value) bubbaman73 143 — 10y
0
How about instead of using a Colon ':' for the 'Timber:IsPlaying()', use a dot '.' instead 'Timber.IsPlaying == true then'. Hope this helped! :) TheeDeathCaster 2368 — 10y
0
okay whoever disliked is a troll :L bubbaman73 143 — 10y

2 answers

Log in to vote
0
Answered by
Nickoakz 231 Moderation Voter
10 years ago

The :IsPlaying() method is more then likely recommended for sounds that are playing in the playergui.

It does not always work as planned when your using it as a global script since someone can join the game when the song was playing, and the song would still be playing for them, while everyone else has to wait until the recently joined players song finishes.

The only workaround is to play the sound in the players playergui, or to do it the ugly way is to make the script wait the length of the sound, stop it, and play the next one.

Just remember to put a message saying that if you recently joined, the first song you hear might be cut off early.

If you are not preloading your assets, It would be great to at up to 10 seconds before stopping and going to the next, since Roblox hasn't loaded the song to the client yet.

Ad
Log in to vote
-1
Answered by
wjs3456 90
10 years ago

This should fix it.

if game.Workspace.Timber:IsPlaying() == true then

This is because you are checking if they are equal.(compares them not setting to a variable) As far as I know all if statements require a '=='

0
OOOH! DUH! THANKS :D bubbaman73 143 — 10y
0
But its still letting the other songs play while that one is :L bubbaman73 143 — 10y
0
Posted ugly hax. Nickoakz 231 — 10y

Answer this question