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

I am having trouble with this sound script?It play at different timing if a player lags.

while true do wait(0) script.Parent.MallMusic.Playing = true wait(35) script.Parent.MallMusic.Playing = false wait(100000) end

The problem is that sometimes it glitches out and play at different timing than it should according to the script if a player lags.(A Small Delay)

5 comments

0

If you are wanting the sounds to sync up on all clients, you need to have the server control the audio.

0

also...whats the point of waiting 100,000 seconds?

0

XD

0

Ummm i was trying to make a camping game so it's based on a story so like after the music end it will stop forever thats why i put 10000000

0

If you don't want the sound to ever play again, simply doing Script.Parent.MallMusic:Stop() will do. The sound will only play if you use :Play() or set playing to true. There is no use putting a long wait at the end of your code :)

2 answers

The problem is either your internet is very slow or something else. I've made a few enhancments to your code for future use.

Dont use Playing = false or Playing = true, instead use :Stop() , :Resume() , or :Play()

spawn(function()
while true do
wait() 
script.Parent.MallMusic:Play() 
wait(35) 
script.Parent.MallMusic:Stop() 
wait(100000)
end
end)

1 comment

0

on local script or script

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