I have this script in my game that's supposed to play audio at a random time then at another random time so on so forth What it's doing is only playing the audio once which is as soon as the player logs into the game and then never playing the audio again. It ignores the math command thing for some reason and just plays it directly at the start.
Can someone help me out?
wait(math.random(10,30)) local Part = script.Parent local Sound = Part:WaitForChild("spooky audio")
Sound:Play()
repeat
If you want some lines to run forever, while
loop would be a great choice
while wait(math.random(10,30)) do local Part = script.Parent local Sound = Part:WaitForChild("spooky audio") Sound:Play() end
In the script, it will loop through all the code inside the while
loop after waiting for random seconds