Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 3 years ago
Edited 2 years ago

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)
0
im no professional, but maybe try and put the while loop in a different script with the variables it needs 1JBird1 64 — 3y
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? 1JBird1 64 — 3y
0
It's a local script User#39895 0 — 3y
0
no expert but do them 1 by 1 I wouldnt put em all together TurkishBTW 2 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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
Both methods didn't work but hey, at least you tought me the why. User#39895 0 — 3y
Ad

Answer this question