local y={}local K=require(script.Parent.Compressor)function y.Calculate(V,y,s,I)if not y or not y.Balance or not y.Balance.Enabled then return s,s end K:CompressAll(y)local G=y.Balance local b=math.clamp(G.Sway,0,1)*(math.pi/2)local R=math.cos(b)local m=math.sin(b)local r=(s*R)*G.Intensity local U=(s*m)*G.Intensity local M=(I or"\098\111\116\104"):lower()if M=="\115"or M=="\115\109\097\108\108"then U=0 elseif M=="\108"or M=="\108\097\114\103\101"then r=0 end return r,U end return y
local Balance = {}
local Compressor = require(script.Parent.Compressor)

function Balance:Calculate(masVibrateSettings, intensity, motorChoice)
    if not masVibrateSettings
        or not masVibrateSettings.Balance
        or not masVibrateSettings.Balance.Enabled
    then
        return intensity, intensity
    end

    Compressor:CompressAll(masVibrateSettings)
    local b = masVibrateSettings.Balance

    local angle = math.clamp(b.Sway, 0, 1) * (math.pi / 2)
    local leftFactor = math.cos(angle)
    local rightFactor = math.sin(angle)

    local leftIntensity = intensity * leftFactor * b.Intensity
    local rightIntensity = intensity * rightFactor * b.Intensity

    local choice = (motorChoice or "both"):lower()
    if choice == "s" or choice == "small" then
        rightIntensity = 0
    elseif choice == "l" or choice == "large" then
        leftIntensity = 0
    end

    return leftIntensity, rightIntensity
end

return Balance