This is a loop audio script that makes a audio play every couple of minutes, Dosen’t seem to work tho, Anyone know why?
while true do
local sound = game.Workspace.ann
if sound == nil then
local sound = Instance.new(“Sound”, game.Workspace)
sound.SoundId = “rbxassetid://130894143”
sound.Name = “ann”
end
if not sound.IsLoaded then
sound.Loaded:wait()
end
sound.TimePosition = 2
sound:Play()
wait(5)
end
If you want the sound to loop you can just use the Looped property. Otherwise, there’s no reason for you to keep creating new sound instances since you already have one. Additionally you can use sound.Ended:Wait() to know when the sound has finished playing.
If you do come to a solution, make sure to post it back here on the forums so that others that come across this thread can benefit from the solution. Thanks!
You should change the title of the thread that more clearly explains what your problem is/was so that people who have a similar issue can find this thread at a latter point; that is how sites like stack overflow have saved so many coders time and sanity.
this makes it so it’s actually once every “few minutes”.
Second, I would make sure that the sound works in the “preview” property of the sound as the ID could not be moderated yet by roblox.
Lastly, I would use:
local sounds = game:GetService("ContentProvider"):PreloadAsync({"assetid1", "assetid2", "assetid3"})
This effectively makes sure that the Content is loaded into the game.