first of all, the second upgrade doesn't increase price and bonus after purchase. it also doesn't take away my fragments.
-- Upgrade 2 --
local part = workspace:WaitForChild("Board1")
local surfaceGui = part.Upgrades
local textButton = surfaceGui.Upgrade2Purchase
local plr = game:GetService("Players").LocalPlayer
local leaderboard = plr:WaitForChild("leaderstats")
local OtherFolder= plr:WaitForChild("OtherFolder")
local Event = game:GetService("ReplicatedStorage").RemoteEvent
local multiplier = OtherFolder.multiplier
local bonus = OtherFolder.bonus
local cost2Label = surfaceGui.Upgrade2Cost
cost2Label.Text = "Cost: "..100
local bonus2Label = surfaceGui.Upgrade2Bonus
bonus2Label.Text = "Bonus: "..1 .."% ".." > "..2 .."% "
local numberFormatter = require(game:GetService("ReplicatedStorage").FormatNumbers)
textButton.MouseButton1Click:Connect(function(click)
print("Clicking Upgrade 2")
local cost = 100 * multiplier.Value
local bonus = 1 + bonus.Value
if leaderboard.Fragments.Value >= cost then
Event:FireServer(cost, "upgrade2")
wait(0.1)
cost2Label.Text = "Cost: "..numberFormatter.format(100 * multiplier.value)
bonus2Label.Text = "Bonus: "..1 .."% ".." > "..2 .."% "..numberFormatter.format(1 + bonus.value)
end
end)
remote:
local RemoteEvent = game:WaitForChild("ReplicatedStorage").RemoteEvent
RemoteEvent.OnServerEvent:Connect(function(plr, cost, upgrades)
print(cost)
if upgrades == "upgrade1" then
plr.leaderstats.Fragments.Value = plr.leaderstats.Fragments.Value - cost
plr.OtherFolder.multiplier.Value *= 4
plr.OtherFolder.bonus.Value *= 2
elseif upgrades == "upgrade2" then
plr.leaderstats.Fragments.Value = plr.leaderstats.Fragments.Value - cost
plr.OtherFolder.multiplier.Value *= 10
plr.OtherFolder.bonus.Value += 1
end
end)
** You are now Level 11! **