I'm a beginner in scripting, i looked up how to add sound to your game on Youtube, and it said the typical LocalScript and put it in the StarterGui, i did, and the sounds i use are used for sound effects for certain things, so when i died in my game all my sound effects replayed, where do i put the sound script to make it not play again when a player dies
When sound is in StarterGui, and player dies, sounds play again?
2 answers
It's commonly said that LocalScripts are to be placed within StarterGui. However, this is actually a bad practice. Scripts should be placed within the parent that is most related to whatever it's functional purpose is supposed to be; therefore, Scripts for GUIs, should only be placed within that folder.
The reason for this mistake is because StarterGui replicates all descendants to the Client, in a folder called PlayerGui. Since this folder is a Client service, LocalScripts can run within them.
For general purpose programs, they should be placed within a folder called: StarterPlayerScripts, this won't disrupt any running programs or cause the issues you're experiencing, while still allowing LocalScripts to run, as it too, is a Client service. To fix your issue, move it to that folder.
StarterPlayerScripts can be found under the StarterPlayer folder.
1 comment
thanks!, it worked, appreciate the help!
Turn off the ResetOnSpawn value on the Gui (by using the properties tab) Steps: Go to your GUI --> Find the "ResetOnSpawn" value (has a checkbox beside it) on your explorer --> Turn the value off (checkbox)
2 comments
im trying to make sound not reset on spawn, my local script is in scriptgui, I dont see a checkbox in my local script properties
i mean my local script for my sound is IN StarterGui
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
StarterGui restarts everytime your character restarts so that's why