Help with Upgrade System

So, when I make a gui pop up, theres a part of the script that detects IF there is a configuration folder called “UpgradedStats”. but when something is maxed, It comes up with an error saying its not in the object. This shouldnt be happening because its checking if its in there.

		if not config.UpgradedStats then
			gui.Selection.Action.Upgrade.Visible = false
			gui.Selection.DamageAfterUpgrade.Text = "+"..(config.UpgradedStats.Damage.Value - config.Damage.Value)
			gui.Selection.RangeAfterUpgrade.Text = "+"..(config.UpgradedStats.Range.Value - config.Range.Value)
			gui.Selection.CooldownAfterUpgrade.Text = "-"..(config.Cooldown.Value - config.UpgradedStats.Cooldown.Value)

You can use config:FindFirstChild("UpgradedStats") to prevent errors if it doesn’t exist


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