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

Brickcolor wont change could someone help?

Asked by 5 years ago

Im trying to get a script to work, but the problem is that in the output it only says 0, meaning it cant find the playbackloudness, can someone help me out please?

01local RS = game:GetService('RunService')
02local soundie = game.Workspace.Sound
03local part = game.Workspace.Baseplate
04 
05while(wait())do
06    if soundie.IsPlaying then
07        print(soundie.PlaybackLoudness/1000)
08        local randX = math.random(0,(soundie.PlaybackLoudness/1000))
09        local randY = math.random(0,(soundie.PlaybackLoudness/1000))
10        local randZ = math.random(0,(soundie.PlaybackLoudness/1000))
11 
12        part.Color = Color3.new(randX, randY, randZ)   
13    end
14end

this script if from another question (https://scriptinghelpers.org/questions/86786/how-do-i-change-the-brickcolor-based-on-playerbackloudness)

1 answer

Log in to vote
0
Answered by 5 years ago

Sound.PlaybackLoudness can only be read from the client, not the server.

01-- LocalScript in StarterPlayer.StarterPlayerScripts
02local RS = game:GetService('RunService')
03local soundie = game.Workspace.Sound
04local part = game.Workspace.Baseplate
05 
06while true do
07    if soundie.IsPlaying then
08        local pLoudness = soundie.PlaybackLoudness
09        print(pLoudness)
10        local randX = math.random(0, pLoudness) / 100
11        local randY = math.random(0, pLoudness) / 100
12        local randZ = math.random(0, pLoudness) / 100
13 
14        part.Color = Color3.new(randX, randY, randZ)   
15    end
16    RS.RenderStepped:Wait()
17end

All the 0's in the output were being read from the server, not the client. The server doesn't actually play the sound, it tells the clients to play the sound. The following script should work.

Also, depending on the sound, the baseplate will flash. The following code fixes the flashing by tweening the colors.

01-- Again, LocalScript in StarterPlayer.StarterPlayerScripts
02local RS = game:GetService('RunService')
03local tweenService = game:GetService('TweenService')
04 
05local waitTime = 0.25
06local easingStyle = Enum.EasingStyle.Linear
07local easingDirection = Enum.EasingDirection.In
08 
09local colorTweenInfo = TweenInfo.new(waitTime, easingStyle, easingDirection, 0, false, 0)
10 
11local soundie = game.Workspace.Sound
12local part = game.Workspace.Baseplate
13 
14local function getNewColor()
15    local pLoudness = soundie.PlaybackLoudness
View all 38 lines...

Just be sure to warn your players about flashing lights.

0
Omg thank you so much! But just one more thing, how do you make it change when its kinda at a bass drop? JustSxript 36 — 5y
0
nevermind c: JustSxript 36 — 5y
0
It should work anyways. SaltyIceberg 81 — 5y
Ad

Answer this question