I'm making a random, color intensive disco game & I wanted to merge a "few" scripts that is in startergui so I did that & it didn't work. Why & Any fix?
Code:
local loudness = music.PlaybackLoudness -- Thats the line that caused it to not work runService.Heartbeat:Connect(function() -- code end)
Edit: I fixed it myself by moving the loudness variable into the heartbeat function.
Example:
runService.Heartbeat:Connect(function() local loudness = music.PlaybackLoudness -- Now it works! -- code end)
The wait() loop yields the thread, so nothing after it runs. I recommend putting the wait() loop at the end or putting everything in it into the RunService.Heartbeat loop (heartbeat does not yield the thread).