Heres my script
print 'Playing Sound 1'
music.SoundId = song1
music:play()
wait(120)
--2--
print 'Playing Sound 2'
music.SoundId = song2
music:play()
wait(120)
repeat
until script.Parent.Arrow.Anchored==false
end
Heres my script
print 'Playing Sound 1'
music.SoundId = song1
music:play()
wait(120)
--2--
print 'Playing Sound 2'
music.SoundId = song2
music:play()
wait(120)
repeat
until script.Parent.Arrow.Anchored==false
end
You can make a while loop that goes on forever, but keep in mind anything after it won't run.
while true do
wait(0.1) --crucial to prevent a studio crash
--anything in here will repeat every .1 seconds
end
Another way to do this is to use renderstepped
game:GetService("RunService").RenderStepped:connect(function()
--put code in here that you want the script to constantly check for updates
end)
RunService method is assuming you're using a LocalScript.
This discussion is preserved as it was. New answers, comments, and votes are closed.
9 comments
Why not just use the edit button?
?
Lua is case sensitive, it's ":Play()" not ":play()"
You have an edit button on every question and answer you write. Right above the remove button.
@M3 it worked when i played the sound, it just doesn't repeat.
You do not need an end for a repeat loop. You should also put a wait in the repeat loop otherwise it will go on forever and error out. Either that or move your music stuff in between the repeat and until. Also, you do not need to make two posts in a row, it will not get your question answered quicker.
Sorry @M3, first day on this site. so used to forums
@M39a9am3R Most Roblox functions/methods have a lowercase first letter equivalent. I'm pretty sure "Sound.Play" is one of them.
There is also an edit button on the Forums...