How to make? class system

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)

And so thank you for your help, when I press with 0 force, will name change?

I think it changes the name if the product was purchased.

Okay, thanks, but how to make sure that when you bought a class and you had the right to say how much strength you need and what the boost will be and the name

With this help, I will press the solution E and thank you!

That’s where everything is Look here just

Ok, we can make that work.

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
		local needed = tpNeeded[selectedClass]
		price.Text = needed
		if tp.Value >= needed 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)

It should show the price when you click on the class.

I mean, a beginner went into the game, saw how much strength he needs and what kind of boost he will have and the name of the class

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
		local needed = tpNeeded[selectedClass]
		price.Text = needed
		if tp.Value >= needed 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)
name.Text = class.Value

This one shows the class the player already has when he joins the game.

thank you again, you can help me with the aura after the purchase, you must have an aura, I can’t do it, I wrote the code yesterday right now, I’ll send it to you

local event = game.ReplicatedStorage.PromoteClass
local alertClients = game.ReplicatedStorage.ServerMessage

local abbrev = game.ReplicatedStorage.AbbrevText

event.OnServerEvent:Connect(function(player)
	

	local currentClass = player.Class.Value:gsub('-', '')
	local currentClass = player.Class.Value:gsub('-', '')
	local nextClassReq
	local nextClass
	local prev
	
	local classes = {
		"FClass",
		"DClass",
		


}		
		-- AURA STUFF --
		
		for i, v in pairs(player.Character:GetChildren()) do
			if v:IsA("BasePart") then
				for idx, value in pairs(v:GetChildren()) do
					if value:IsA("ParticleEmitter") or value:IsA("Attachment") and value:FindFirstChildWhichIsA("ParticleEmitter") then
						value:Destroy()
					end
				end
			end
		end
		
		-- ADD NEW AURA --
		
		local aura = game.ServerStorage.Powers.Auras[currentClass.."Aura"]:Clone()
		aura.Parent = player.Character
		
		for i, v in pairs(aura:GetChildren()) do
			v.Parent = player.Character[v.Name]
		end
		
		aura:Destrou()
end)

I have auras in serverstorage in the power folder and in the aura folder and there will be the name of the aura, that is, the part, and they will be the name

I think that is a typo in the script.

hello I’m buying a class I don’t have an aura

and my script does not work for boost, that is, you buy a class from me does not show how much boost power I have

and tell me how you can add classes and so on, and you can add an abbreviation?

here I added the script how many classes I wanted after the f class no longer buys how to make it so that it was bought and I would also like an abbreviation

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 = {"F-Class", "E-Class", "D-Class", "C-Class", "B-Class", "A-Class", "S-Class", "SS-Class", "SSS-Class", "X-Class", "Y-Class", "Z-Class", "XYZ-Class" }
local boosts = {["F-Class"]=2, ["E-Class"]=5, ["D-Class"]= 20, ["C-Class"]= 100, ["B-Class"]=500, ["A-Class"]=2500, ["S-Class"]=12500, ["SS-Class"]=150000, ["SSS-Class"]=1500000, ["X-Class"]=30000000, ["Y-Class"]=1000000000, ["Z-Class"]=40000000000, ["XYZ-Class"]=400000000000}  --e3=000, 1e3 = 1000, 10e3 = 10000
local tpNeeded = {["F-Class"]=1000000, ["E-Class"]=100000000, ["D-Class"]=20000000000, ["C-Class"]=3990000000000, ["B-Class"]=5000000000000000, ["A-Class"]=99000000000000000000,["S-Class"]=100000000000000000000000,["SS-Class"]=4990000000000000000000000000,["SSS-Class"]=10000000000000000000000000000000000,["X-Class"]= 50000000000000000000000000000000000000000,["Y-Class"]=100000000000000000000000000000000000000000000,["Z-Class"]=10000000000000000000000000000000000000000000000,["XYZ-Class"]=24800000000000000000000000000000000000000000000000   } --total power needed
local desc = script.Parent.Parent.Desc
local NameText = script.Parent.Parent.NameText
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 = "E-Class"	
		selectedClass = "D-Class"
		selectedClass = "C-Class"
		selectedClass = "B-Class"
		selectedClass = "A-Class"
		selectedClass = "S-Class"
		selectedClass = "SS-Class"
		selectedClass = "SSS-Class"
		selectedClass = "X-Class"
		selectedClass = "Y-Class"
		selectedClass = "Z-Class"
		selectedClass = "XYZ-Class"
	end
	selectedClass = selectedClass or "F-Class"
	if table.find(accepted, selectedClass) and class.Value ~= selectedClass then
		local needed = tpNeeded[selectedClass]
		price.Text = needed
		if tp.Value >= needed 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)
name.Text = class.Value

Try this code, its more readable and stable.

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 = {"F-Class", "E-Class", "D-Class", "C-Class", "B-Class", "A-Class", "S-Class", "SS-Class", "SSS-Class", "X-Class", "Y-Class", "Z-Class", "XYZ-Class" }
local boosts = {["F-Class"]=2, ["E-Class"]=5, ["D-Class"]= 20, ["C-Class"]= 100, ["B-Class"]=500, ["A-Class"]=2500, ["S-Class"]=12500, ["SS-Class"]=150000, ["SSS-Class"]=1500000, ["X-Class"]=30000000, ["Y-Class"]=1000000000, ["Z-Class"]=40000000000, ["XYZ-Class"]=400000000000}  --e3=000, 1e3 = 1000, 10e3 = 10000
local tpNeeded = {["F-Class"]=1000000, ["E-Class"]=100000000, ["D-Class"]=20000000000, ["C-Class"]=3990000000000, ["B-Class"]=5000000000000000, ["A-Class"]=99000000000000000000,["S-Class"]=100000000000000000000000,["SS-Class"]=4990000000000000000000000000,["SSS-Class"]=10000000000000000000000000000000000,["X-Class"]= 50000000000000000000000000000000000000000,["Y-Class"]=100000000000000000000000000000000000000000000,["Z-Class"]=10000000000000000000000000000000000000000000000,["XYZ-Class"]=24800000000000000000000000000000000000000000000000   } --total power needed
local desc = script.Parent.Parent.Desc
local NameText = script.Parent.Parent.NameText
local price = script.Parent.Parent.PriceText
local boost = script.Parent.Parent.BoostText
local classname = script.Parent.Parent.ClassNameText

script.Parent.MouseButton1Click:Connect(function()
	local Class_Number = table.find(accepted, tostring(class.Value))
	
	selectedClass = 'F-Class'

	if Class_Number ~= nil then
		selectedClass = accepted[Class_Number + 1]
	end
	
	if selectedClass and class.Value ~= selectedClass then
		local needed = tpNeeded[selectedClass]
		price.Text = needed
		if tp.Value >= needed then
			setClass:FireServer("Class", selectedClass, "set")
			reset:FireServer()
			
			name.Text = selectedClass
			classname.Text = selectedClass
			boost.Text = `boost: {boosts[selectedClass]}`
		end
	else
		-- You bought all classes
	end
end)

name.Text = class.Value

thank you it worked, but how to make an abbreviation and make it so that the player shows what kind of boost he has, I show what the next one will be