#ui/script bug

1 messages · Page 1 of 1 (latest)

balmy ferry
#

so as you can see that i can bought the +1 speed and + 10 speed with the same price,please tell me how do i fix this

steady sand
#

change the values

#

moron

balmy ferry
steady sand
balmy ferry
#

1 sec

#

-- Called by Client (Money Purchase)
function SpeedSystem.PurchaseUpgrade(player: Player, amount: number)
if amount ~= 1 and amount ~= 5 and amount ~= 10 then return end

local profile = PlayerController:GetProfile(player)
if not profile then return end

local currentSpeed = profile.Data.Speed or BASE_WALKSPEED
local price = getBulkPrice(currentSpeed, amount)

if PlayerController:DeductMoney(player, price) then
    applySpeedUpgrade(player, amount, profile)

    local Events = ReplicatedStorage:FindFirstChild("Events")
    local notif = Events and Events:FindFirstChild("ShowNotification")
    if notif then notif:FireClient(player, "+" .. amount .. " Speed Upgraded!", "Success") end
else
    local Events = ReplicatedStorage:FindFirstChild("Events")
    local notif = Events and Events:FindFirstChild("ShowNotification")
    if notif then notif:FireClient(player, "Not enough money!", "Error") end
end

end

-- ## ADDED: Called by MonetizationController (Robux Purchase) ##
function SpeedSystem.GrantSpeed(player: Player, amount: number)
local profile = PlayerController:GetProfile(player)
if not profile then return end

applySpeedUpgrade(player, amount, profile)

end

function SpeedSystem.UpdateClientUI(player: Player)
local profile = PlayerController:GetProfile(player)
if not profile then return end

local currentSpeed = profile.Data.Speed or BASE_WALKSPEED

-- Use String Keys
local priceData = {
    ["1"] = getBulkPrice(currentSpeed, 1),
    ["5"] = getBulkPrice(currentSpeed, 5),
    ["10"] = getBulkPrice(currentSpeed, 10)
}

local Events = ReplicatedStorage:FindFirstChild("Events")
local updateEvent = Events and Events:FindFirstChild("UpdateSpeedUI")

if updateEvent then
    updateEvent:FireClient(player, priceData, currentSpeed)
end

end

#

@steady sand

#

it works fine after the first purchase

neon timber
tough sun
balmy ferry
balmy ferry
# tough sun show me this function

function SpeedSystem.UpdateClientUI(player: Player)
local profile = PlayerController:GetProfile(player)
if not profile then return end

local currentSpeed = profile.Data.Speed or BASE_WALKSPEED

-- Use String Keys
local priceData = {
    ["1"] = getBulkPrice(currentSpeed, 1),
    ["5"] = getBulkPrice(currentSpeed, 5),
    ["10"] = getBulkPrice(currentSpeed, 10)
}

local Events = ReplicatedStorage:FindFirstChild("Events")
local updateEvent = Events and Events:FindFirstChild("UpdateSpeedUI")

if updateEvent then
    updateEvent:FireClient(player, priceData, currentSpeed)
end

end