Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

After merging a "few" scripts into 1, the script does not work. Why?

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)

4 comments

0

im no professional, but maybe try and put the while loop in a different script with the variables it needs

0

is this in a local script or a server script? Because you’re trying to call the local player, and changing things that should probably require a remote event, unless its something the player only wants to see?

0

It's a local script

0

no expert but do them 1 by 1 I wouldnt put em all together

1 answer

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).

1 comment

1

Both methods didn't work but hey, at least you tought me the why.

This discussion is preserved as it was. New answers, comments, and votes are closed.