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

Script resets when I die?

How would I fix this script so when I die it doesn't reset the music?

--[songs]--
song1 = "http://www.roblox.com/asset/?id=398513340"
song2 = "http://www.roblox.com/asset/?id=255854737"
song3 = "http://www.roblox.com/asset/?id=313512044"
song4 = "http://www.roblox.com/asset/?id=273387130"
song5 = "http://www.roblox.com/asset/?id=291168836"
song6 = "http://www.roblox.com/asset/?id=362605449"
song7 = "http://www.roblox.com/asset/?id=316290232"
song8 = "http://www.roblox.com/asset/?id=360536889"
song9 = "http://www.roblox.com/asset/?id=228676342"
song10 = "http://www.roblox.com/asset/?id=285160931"
song11 = "http://www.roblox.com/asset/?id=227475817"
song12 = "http://www.roblox.com/asset/?id=383873361"
song13 = "http://www.roblox.com/asset/?id=370220429"
song14 = "http://www.roblox.com/asset/?id=387819539"
song15 = "http://www.roblox.com/asset/?id=395794636"
song16 = "http://www.roblox.com/asset/?id=142435409"
song17 = "http://www.roblox.com/asset/?id=235855135"
song18 = "http://www.roblox.com/asset/?id=283801001"
song19 = "http://www.roblox.com/asset/?id=181547615"
song20 = "http://www.roblox.com/asset/?id=274727125"
song21 = "http://www.roblox.com/asset/?id=319758951"
song22 = "http://www.roblox.com/asset/?id=243372213"

--[dont touch this]--
local music = Instance.new("Sound") 
music.Archivable = true 

--[variables]--
music.Parent = script.Parent 
music.Pitch = 1 
music.Volume = .5 
music.Looped = false 
music.Name = "Player" 


--[[plays songs]]--
    --1--
while (true) do
	print 'Playing Sound 1'
	game.Players.LocalPlayer.PlayerGui.Song.Frame.SongName.Text = 'Current Song: Desiigner- Panda' 
	
music.SoundId = song1 
music:play()
wait(120.137)
	--2--
	print 'Playing Sound 2'
	game.Players.LocalPlayer.PlayerGui.Song.Frame.SongName.Text = 'Current Song: The Weeknd- The Hills'
	
music.SoundId = song2
music:play() 
wait(120.084)
	--3--
	print 'Playing Sound 3'
	game.Players.LocalPlayer.PlayerGui.Song.Frame.SongName.Text = 'Current Song: Justin Bieber- Sorry'
	
music.SoundId = song3
music:play() 
wait(117.342)

1 answer

✓ Accepted answer

I assume you're placing it in the PlayerGui, or perhaps their Backpack. To have a local script run, even when a character resets, you'll need to place it in StarterPlayerScripts, which is a descendant of StarterPlayer. If you couldn't tell by the name, the script will start once the Player joins the game, and will not re-start once a player respawns.

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