Color doesn't sync with music when using playbackloudness; too slow and not responsive enough

Hi there, I have a script that uses tween and playbackloudness to change the color of a part. The issue here is that the color changes more like a metronome and doesn’t actually correspond to the loudness of the music, rather the beat. I want to achieve so that instead, so it’s a lot faster and responsive with the music (basically the sensitivity of it). I have tried changing the different values inside the script however none appeal to my request.

Script below:

local sound = workspace:WaitForChild("Sound")
local part = workspace.parts["Club Floor"]
local TweenService = game:GetService("TweenService")
local TweeningInformation = TweenInfo.new(
	2,
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.Out,
	753475938457843579348573,
	true,
	0
)

local PartProperties = {
	Color = Color3.fromRGB(sound.PlaybackLoudness, 84, 185)
}

local Tween = TweenService:Create(part,TweeningInformation,PartProperties)
Tween:Play()

Isn’t sound.PlaybackLoudness not good for color changes

you can try next like

if loudness > 1 then
 color3.fromRGB(100, 0, 0)
elseif loudness < 1 then
 color3.fromRGB(50, 0, 0)
end

Problem is, is that it’s changing between two colours and not through different colours (like a fading pattern).

are you using any loops for animation, can i see full code?

No, I am not using any loops. That is the full code (:

I think I found the problem, I just opened studio and tested a little script:

print(script.Parent.Name .. " loaded!")
local part = workspace.Part

wait(10)

local TweenService = game:GetService("TweenService")

local info = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, false, 0)
local tween = TweenService:Create(part, info, {
	Color = Color3.fromRGB(255, 0, 255)
})
tween:Play()

Problems I found in your TweenInfo:
You seem to have set the repeat count of your tween to 753475938457843579348573.
And you have the reverseTween boolean set to true as well.

You might wanna read this: Tween | Roblox Creator Documentation
And this might be interesting as well: TweenService | Roblox Creator Documentation

Forgot to send you guys a vid, I’ll send it a moment

Someone else on one of my other topics said I could use -1 however I tried, and the (pattern) went a lot faster for some odd reason.

local sound = workspace:WaitForChild("Sound")
local part = workspace.parts["Club Floor"]
local TweenService = game:GetService("TweenService")
local TweeningInformation = TweenInfo.new(
	2,
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.Out,
	753475938457843579348573,
	true,
	0
)
local function getRand()
	return math.round(sound.PlaybackLoudness/math.random(0, 255))
end

local PartProperties = {
	Color = Color3.fromRGB(getRand(), getRand(), getRand())
}

local Tween = TweenService:Create(part,TweeningInformation,PartProperties)
Tween:Play()

Why do you need to repeat the tween?

I don’t see a loop in the script. What exactly do you mean?

Open the links I sent in my post, read the documentation about TweenInfo.

Alright.

are you doing this in client, because if i’m right. server always has 0 playback loudness

Yeah you can’t tween to a color but you can still change the color through a tween (what I added just randomises the color).

Oh I noticed you from my other post. Would it have to be randomised though? In one of my other topics, a guy did something a bit different where it worked, but it was stuck to just tweening through red (I couldn’t change that color otherwise I got a clamp error)

Yes I am, under startergui.

You could achieve a fading effect with a loop.

I found that helpful, also is the delay time the time it delays between the two colours it fades through?

for i = 1, 255 do
	task.wait()
	frame.Color = Color3.fromRGB(i, 0, 0)
end

For example.