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

How to stop the song replaying itself when player respawns? [solved]

Asked by
RAYAN1565 691 Moderation Voter
10 years ago

I have a script and it is an introduction song. But it tends to replay the script once the player resets or respawns his/her own character. Any advice on fixing the script to not allow it to replay the song upon reseting your own character?

local time = 42 
Game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        local song = Workspace.Introduction.WomanKing
        local clone = song:Clone()
        clone.Parent = plr
        wait(10)
        clone:Play()
        wait(45)
        clone.Volume = 0.6
        wait(0.2)
        clone.Volume = 0.5
        wait(0.2)
        clone.Volume = 0.4
        wait(0.2)
        clone.Volume = 0.3
        wait(0.2)
        clone.Volume = 0.2
        wait(0.2)
        clone.Volume = 0.1
        wait(0.2)
        clone.Volume = 0.0
        repeat
        clone:Stop()
        until clone.IsPlaying == false
    end)
end)

2 answers

Log in to vote
1
Answered by
acecateer 130
10 years ago

Take out line 3.

Sorry I thought you meant to make it play every time someone spawns, by taking out line 3 it will only play when the player joins the game.

1
Thank you so much @acecateer RAYAN1565 691 — 10y
0
:D acecateer 130 — 10y
1
When i toke it out, the song stopped playing completely :( RAYAN1565 691 — 10y
0
That's because you have to take out the 'end)' on line 27, you should have a basic understanding of putting ends in scripts right? acecateer 130 — 10y
View all comments (2 more)
1
Oh yea i forgot lol RAYAN1565 691 — 10y
0
Lol k. acecateer 130 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

Probably delete CharacterAdded. Find me on Roblox.

Answer this question