local a=1 while a<10 do game.SoundService.allstar.PlaybackSpeed=a a=game.SoundService.allstar.PlaybackSpeed+1 wait(1) end
This is a script i'm using (allstar is the name of the sound i'm playing) and I need help making a loop like this so that the song speeds up until it's incomprehensible.
OH I THINK I UNDERSTAND NOW, so the a=blablabla =+ 1 can be a problem. NOt that its not in quotes. quotes are for string). but i think its that when you set variable that equals something then does something to it, its kind of like a function, so its mor like a = do this, and that is not a number so i cant be less than 10, so do this maybe?:
local a=1 while a<10 do game.SoundService.allstar.PlaybackSpeed=a a=game.SoundService.allstar.PlaybackSpeed+1 wait(1) end
to
for a = 1,10,1-- makes sound volume go from 1 to 10 by ones. game.SoundService.allstar.PlaybackSpeed = a -- preforms action on this sound wait(1)--wait 1 second, 1! end
So basicly i litteraly changed like the whole thing to a for loop until it finishes. This makes every second the sound or whatever goes 1 higher because a means go from 1 to ten by ones so every second yeah, it does that. Hope this helps / answered this :D
OH and by the way in case you dont know, dont waste storage in workspace, make a script in ServerScriptService and put this code inside and script will work. kk dude;)
local SoundService = game:GetService("SoundService") -- Sound Service local Sound = SoundService:WaitForChild("allstar") -- The Sound Object local Pitch = 1 -- PlaybackSpeed Sound:Play() while Pitch<10 do Sound.PlaybackSpeed = Pitch -- Changes PlaybackSpeed Pitch = Pitch + 1 -- adds 1 to pitch wait(1) -- waits end