The text changes when the button is pressed, not when the class is purchased, but it can be changed.
I changed it:
local player = game.Players.LocalPlayer
local tp = player["TotalPower"]
local class = player.Class
local name = script.Parent.Parent.ClassNameText
local reset = game.ReplicatedStorage.ResetStats
local setClass = game.ReplicatedStorage.AddStat
local selectedClass
local accepted = {"D-Class", "F-Class"}
local boosts = {["F-Class"]=1e4, ["D-Class"]=15e3} --e3=000, 1e3 = 1000, 10e3 = 10000
local tpNeeded = {["F-Class"]=0, ["D-Class"]=50} --total power needed
local desc = script.Parent.Parent.Desc
local price = script.Parent.Parent.PriceText
local boost = script.Parent.Parent.BoostText
local classname = script.Parent.Parent.ClassNameText
script.Parent.MouseButton1Click:Connect(function()
if class.Value == "F-Class" then
selectedClass = "D-Class"
end
selectedClass = selectedClass or "F-Class"
if table.find(accepted, selectedClass) and class.Value ~= selectedClass then
if tp.Value >= tpNeeded[selectedClass] then
setClass:FireServer("Class", selectedClass, "set")
reset:FireServer()
name.Text = selectedClass
classname.Text = selectedClass
local boostnum = boosts[selectedClass]
boost.Text = "boost: "..boostnum
end
end
end)