Music doesn't delay by 10 seconds

The audio is delaying 10 seconds but not the way you want. I’ll probably explain it in the wrong manner but I’m sure you’ll understand. Whenever you press to play the game, the moment you join (or another player join) the script already begins running almost imediately even if the character didnt load yet. Due to that, the script is already waiting the time you specified and, when you character load, it will wait a “lower” time. It doesn’t wait for your or another player character to spawn to start running. It will start running as soon a server start

From this I can tell you want the sound to play 10 seconds after your character spawn. Not sure the purpose you want to play the sound but you can do something like this:

local player = game:GetService("Players").PlayerAdded:Wait()

-- Yields the script until the player's character spawn
player.CharacterAdded:Wait()

-- When the script reach this line, the player will have spawned
task.wait(10)

script.Music:Play()

This script will run only once and for a single player but might help you get your desired result. Some explaination might be somewhat wrong since I’m terrible at explaining it in the technical way and since I’m still a beginner too

3 Likes

More optimistic, you could try

task.delay(10, function()
script.Music:Play()
end

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