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

When sound is in StarterGui, and player dies, sounds play again?

Asked by 5 years ago

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

0
StarterGui restarts everytime your character restarts so that's why RealTinCan 217 — 5y

2 answers

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
5 years ago
Edited 5 years ago

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.

0
thanks!, it worked, appreciate the help! catiwishihadyou 2 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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)

0
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 catiwishihadyou 2 — 5y
0
i mean my local script for my sound is IN StarterGui catiwishihadyou 2 — 5y

Answer this question