RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a text button that will change classic sword damage using gold"
-- local script local textButton = script.Parent local player = game.Players.LocalPlayer local leaderstats = player.leaderstats local swordDamage = 10 -- default sword damage local upgradeCost = 50 -- cost to upgrade sword damage local function upgradeSwordDamage() if leaderstats.Gold.Value >= upgradeCost then leaderstats.Gold.Value = leaderstats.Gold.Value - upgradeCost swordDamage = swordDamage + 5 textButton.Text = "Upgrade Sword Damage (Cost: " .. upgradeCost .. ")" end end textButton.MouseButton1Click:Connect(upgradeSwordDamage) -- Note: This script assumes you have a leaderstats object with a Gold IntValue for the player. You also need to modify the sword damage script to use the swordDamage variable from this script.