I'm trying to make a script, so that when the value of one text label equals the max level of Exp, the 2nd text label will update the level by one, and the 1st text label goes back 0, while the max Exp required to level up is increased by 1.5

Here is the script

local StatsFolder = script.Parent.Parent.Parent.Parent:WaitForChild("Stats")
local ExpIntValue = StatsFolder.Exp
local LevelValue = StatsFolder.Level
local MaxExp = StatsFolder.MaxExp

LevelValue.Value = 1

script.Parent.Text = "Exp: "..ExpIntValue.Value.."/ "..MaxExp.Value
ExpIntValue:GetPropertyChangedSignal("Value"):connect(function()

MaxExp.Value = LevelValue * 1.5
print(MaxExp)

if ExpIntValue == MaxExp then 
	LevelValue.Value = LevelValue.Value + 1
	ExpIntValue.Value = 0
end


script.Parent.Text = "Exp: "..ExpIntValue.Value.."/ "..MaxExp.Value
end)



4 comments

0

Are "ExpIntValue" and "LevelValue" int values(or any type of value)?

0

What is "script.Parent.Parent.Parent.Parent"

0
  1. the long line of "Parents is only to get the local player"
0
  1. The ExpIntValue and LevelValue are just the varable for the int values in the player