so i watched a few youtube tutorials on how to get songs to play on which none of them worked so i used some common sense and a bit of information i have gathered to make make this:
while true do
wait(5)
script.Parent.insertid:Play()
wait (script.Parent.insertid.TimeLength)
script.Parent.insertid:Stop()
end
I’m pretty proud of this because I only watched like 2 or 3 non-working tutorials and I have 0 experience with scripting.
the addition of the stop prevents it all from playing at once if i added 10 audio ids. i dont have --loop but it loops anyway, idk what part does it but it works lol.
I’m going to go ahead and ignore the first two replies and just address your code.
First off, while not related to the code itself, put your code in a Lua code block like so:
```lua
– Code
```
becomes
-- Code
Use the Sound.Ended event here instead; no need to reinvent the wheel. I understand you are beginner so you might reinvent the wheel a lot but eventually you find out Roblox has a built-in way of doing what you want
Now I would make a reference to the sound through a variable so you don’t repeat yourself.
and uh, that is it really lol
local sound = script.Parent:WaitForChild("insertid")
while true do
wait(5)
sound:Play()
sound.Ended:Wait()
end