Hi so my upgradesGUI works but when i buy a item it shows the correct price I want but it removes half of the gems of the price it should be, how could i fix this?
Infochanger:
local moreRebirthsButton = script.Parent local infoHolder = moreRebirthsButton.Parent.Parent.infoHolder local price = infoHolder.Cost.price local upgradeInfo = infoHolder.upgradeInfo local upgradeName = infoHolder.upgradeName local lastPrice2 = 250 --Last price local Players = game:GetService("Players") local player = Players.LocalPlayer local upgradesFile = player:WaitForChild("Upgrades") local maxRebirthButtons = 4 moreRebirthsButton.MouseButton1Up:Connect(function() local rebirthButtonsData = upgradesFile:WaitForChild("rebirthButtons") if rebirthButtonsData.Value < maxRebirthButtons then upgradeInfo.Text = "Purchasing this will give you a extra rebirth button!" upgradeName.Text = "Rebirth Buttons" price.Text = lastPrice2 .. " Gems" --Update Tex if infoHolder.Visible == false then infoHolder.Visible = true end else upgradeInfo.Text = "Purchasing this will give you a extra rebirth button!" upgradeName.Text = "Rebirth Buttons" price.Text = "Max" if infoHolder.Visible == false then infoHolder.Visible = true end end rebirthButtonsData.Changed:Connect(function() price.Text = lastPrice2 .. " Gems" --Update Tex lastPrice2 *= 2 --Set Last price to the new Price if rebirthButtonsData.Value >= maxRebirthButtons then price.Text = "Max" end end) end)
upgradeSender:
local buyButton = script.Parent local infoHolder = buyButton.Parent local replicatedStorage = game:GetService("ReplicatedStorage") local remoteEvents = replicatedStorage:WaitForChild("remoteEvents") local buyUpgrade = remoteEvents:WaitForChild("buyUpgrade") local Players = game:GetService("Players") local player = Players.LocalPlayer local upgrades = player:WaitForChild("Upgrades") local leaderstats = player:WaitForChild("leaderstats") local lastPrice = 500 --Last price local lastPrice2 = 250 local maxRebirthButtons = 4 local maxClicksMultiplier = 5 buyButton.MouseButton1Up:Connect(function() local upgradeName = infoHolder:WaitForChild("upgradeName") local gems = leaderstats.Gems.Value if upgradeName.Text == "Rebirth Buttons" then local rebirthButtons = upgrades:WaitForChild("rebirthButtons").Value if rebirthButtons < maxRebirthButtons then lastPrice2 *= 2 if gems >= lastPrice2 then buyUpgrade:FireServer("rebirthButtons",lastPrice2) end end elseif upgradeName.Text == "Clicks Multiplier"then local clicksMultiplier = upgrades:WaitForChild("ClicksMultiplier").Value if clicksMultiplier < maxClicksMultiplier then lastPrice *= 2 --Set Last price to the new Price if gems >= lastPrice then buyUpgrade:FireServer("clicksMultiplier",lastPrice) end end end end)