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

How can I make this sound on join script work without lag?

So this is the script I currently use to make a sound play when a player joins the game:

game.Players.PlayerAdded:connect(function(player)
    repeat wait() until player:findFirstChild("PlayerGui") -- Waits for PlayerGui to load
    player.PlayerGui.Sound:Play(Intro)
end)

And it worked fine. However, after I built my game, the sound now takes 10-15 seconds to play. I think it is because of line 2 where it waits for the player gui. Is there a way I can make it play, for only the player who joins, as soon as they join, without the lag?

1 answer

Try putting line 3 before line 2? Or you can make a separate script for the sound or GUI.

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