Sound Script Has Latency

Hi I would like to know why this script for playing sounds has latency:

--Script by Mr_RainBowsYT
local PitchValue = 1
local MainVolume = 1
local nextSongPlayTime = 2 -- Seconds until the next song will be played, if you want you can leave it at 2.(2 is the default)

-- Ne pas modifier le script --

local songs = {1585166473,4998677536,1606919876}
local sound = script.Parent

sound.Pitch = PitchValue
sound.Volume = MainVolume

while true do
	sound.SoundId = "rbxassetid://"..songs[math.random(1,#songs)]
  1. When I hit run/play on roblox studio or roblox player, it has a ~8 second latency and sometimes a part of the sound plays for 2 seconds and gets stopped by the next sound instead of playing the first sound at start.

  2. I tried looking in the dev foru but nothing seems to talk about this



Internet performance: image

I think it’s because the server is still loading the sound ID.

1 Like

Well that seem right but when i simply put a script with 1 song it play immediately so I don’t understand much :sweat_smile: (also i’m not an english native so my english is kinda broken)

1 Like

Random latency? I don’t know a lot about this, but I already encountered this problem also.

1 Like

Well at least i’m not alone… I’m going to wait for other people’s opinion, thanks for sharing that info whelp no one