Scripts only working for first character spawned in

I have a couple local scripts as described below:

  • Randomizes a decal - startercharactersscripts
  • Plays a sound when a button is pressed (connected to a remote event) - startercharacterscripts
  • Shows GUI tween when a button is pressed - startergui
  • I am currently working on making some part tween local so I have placed them into startercharacterscripts

these scripts are all buggy and either only perform for the first player that joins or doesn’t work for another player after one has been performed. I’m not necessarily looking for a direct answer as there are multiple variables but maybe just a nudge in the correct direction?

Your idea of where to place specific scripts is not correct
StarterCharacterScripts is for scripts that modify the Character in any way e.g. playing animation, changing decal, teleporting etc.
StarterPlayerScripts is for scripts that you just generally want in the local player, so they’re ideal for player-specific code eg. Playing a sound, Giving tools etc.
StarterGui is for scripts that add, remove or modify Gui elements that only the clients (players) can see, so every script related to that stated above MUST be placed here and not anywhere else eg. Tweening frames, Changing color of text button etc.

1 Like

Thank you, this definitely helped me have a better idea of where each script should be placed, I do want to ask however sometimes I have placed in starterplayerscripts such as the local part tween, decal, and sound scripts however they stopped working overall when placed in starterplayer do I maybe need to add something to these scripts for them to work properly like a waitforplayeradded ?

The contents of the “starter” folders replicate to the player when they join the game (starter player scripts, starterGui) or when their character respawns (starter character scripts) so there is no need to add a wait statement, the script will wait for the condition to occur. As for them not working, you need to place them in the correct starter folder as stated in post #1. If it still doesn’t work, then you should probably check your code

1 Like

Thank you so much! In that case, if I continue to struggle I will probably post those scripts as separate posts.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.