#ui/script bug
1 messages · Page 1 of 1 (latest)
If that solve the problem this post wouldnt existed
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
We don't need anymore escape tsunami games
show me this function
Oh im testing out a free template i js got
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