#Multiplier Thing

1 messages · Page 1 of 1 (latest)

lean tendon
#

Its 7am i been tryna do ts for ages heres my scripts

local:

local GUI = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local multiplierConfig = require(ReplicatedStorage.MultiplierConfig)

local MultiplierEvent = ReplicatedStorage.MultiplierEvent
local ResetMulti = ReplicatedStorage.ResetMulti

local buttons = GUI.MultiplierFrame.Multipliers
local priceLabels = GUI.MultiplierFrame.MultipliersLabel

local GlobalPriceMulti = 1

local suffixes = {"K","M","B","T","Qa","Qi","Sx","Sp","Oc","No"}

local function formatCash(n)
    if n < 1000 then return tostring(n) end
    local i = math.floor(math.log10(n)/3)
    local suffix = suffixes[i] or ""
    local scaled = n / (10^(i*3))
    return string.format("%.2f%s", scaled, suffix)
end

local GlobalPriceMulti = 1

local function updateAllPrices()
    for name, data in pairs(multiplierConfig) do
        local label = priceLabels:FindFirstChild(name.."Price")
        if label then
            local price = data.BasePrice * GlobalPriceMulti
            label.Text = "$" .. formatCash(price)
        end
    end
end


for name, data in pairs(multiplierConfig) do
    local button = buttons:FindFirstChild(name)

    if button then
        button.MouseButton1Click:Connect(function()
            local newMulti = MultiplierEvent:InvokeServer(name)
            GlobalPriceMulti = newMulti
            updateAllPrices()
        end)
    end
end

ResetMulti.OnClientEvent:Connect(function()
    GlobalPriceMulti = 1
    updateAllPrices()
end)

updateAllPrices()

module:

local MultiplierConfig = {
    x2Multiplier  = {Multiplier = 1,  BasePrice = 1e5},
    x5Multiplier  = {Multiplier = 5,  BasePrice = 2.5e5},
    x15Multiplier = {Multiplier = 15, BasePrice = 8e5},
    x50Multiplier = {Multiplier = 50, BasePrice = 24e5},
}

return MultiplierConfig
#

idk if im blind and im missing something obvious because its 7am or what, but why aint this working

#

im tryna make it so like the 100k one bought would be 300k next, and the 2mil one wouldnt be 6mil type shi, and reverse 2mil bought would be 6mil, the 100k would be like fuckin idek bro its so late

#

anyone wanna help w the maths n shi go ahead im going bed for a bit

ancient dirge
#

Thats cuz you have a global multiplier

#

Which causes all the prices to increase even if you only bought one multiplier

lean tendon