I have been trying to figure out how to create a script for a character to load first before the other scripts take place. I have been trying to figure this out because I need a sound to play in an area when the character has touched the brick that has the sound in it, however, it only plays for two seconds and then stops because the character is not fully loaded in. Anyone know how to make a script to wait for the character to load? Here are my music scripts.
script.Parent.Touched:connect(function(part)
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
if plr then
script.Parent.MufiaPlaza:Play()
end
end)
Here is the second script for when the character leaves the "Part."
script.Parent.TouchEnded:connect(function(part)
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
if plr then
script.Parent.MufiaPlaza:Stop()
end
end)

3 comments
Lmao, I read your previous answers. Yeah, and when I take out the "TouchEnded" script, the music plays perfectly fine... I will try the variable thing right now though.
If you need a wiki reference, @cmgtotalyawesome was talking about debounce: http://wiki.roblox.com/index.php?title=Debouncel
Thank you so much! :) I never used the debounce code before, so I guess it is time to learn some more ;I