My script isnt working for the upgrade button

my script is this:


my output and explorer:

Screenshot 2023-04-13 124417
video:
robloxapp-20230413-1245290.wmv (575.7 KB)
and its suppose to be going up from 0 when i click

Your setting the text before updating the value itself

I think you were only supposed to put one Parent on line 1. Same with AmountUpgraded

replace the 1st, 2nd, 4th and 7th line with

local AmountLeft = script.Parent.AmountOfUpgrades.AnountLeft --line 1
local AmountUpgraded = AmountLeft.Parent.AmountUpgraded --line 2
AmountLeft.AmountOfUpgrades.Text = AmountUpgraded.Value.."/"..AmountLeft.Value --line 4
AmountLeft.AmountOfUpgrades.Text = "MAX" --line 7

and it should work fine

You should put one Parent for the AmountOfUpgrades

now its saying this:

very simple solution

change your script to this one

local AmountLeft = script.Parent.AmountOfUpgrades.AmountLeft
local AmountUpgraded = script.Parent.AmountOfUpgrades.AmountUpgraded

script.Parent.MouseButton1Click:Connect(function()

AmountUpgraded.Value = AmountUpgraded.Value + 1

script.parent.AmountOfUpgrades.Text = AmountUpgraded.Value.." / "..AmountLeft.Value

if AmountUpgraded.Value >= 12 then
script.Parent.AmountOfUpgrades.Text = "Max"
end 
end)

and everything should work

yay tysm it worked brill I struggled since i’m quite new to coding in rbx.

1 Like

Your welcome :blush:

the reason it didn’t work because you put two parents, the script went to scrolling frame and got confused because it dosen’t have any child in the name of AmountOfUpgrades
because it is in the Gem Upgrade not in the scrolling Frame

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.