How to make? class system

Hello, let’s continue to create a class system, do you mind?

Okay, we can continue the system, but the issue is unknown in my case it seems like it’s trying to put a word instead of a number.

It is a pity that we do not have the same time zone

Yes, I agree. I need to go in a few minutes, but it must be done eventually. Also, what is the local script contents you have so far?

now I just want to do anything with you, suddenly I’ll make a mistake

Let me give you access from Roblox Studio

I don’t need the access, just the content of the local script, it should just be simple problem with the system is giving string instead of integer.

no, I mean, you can see for yourself what’s in the scripts and don’t write it

Well, what kind of local script do you want

The one that does the FireServer to the add stat

sorry I don’t have it I didn’t find it

hello, I was helped with the addstats script, we can do what I wanted, namely, pressing the button buys a class from the player

local event = game.ReplicatedStorage.AddStat
local alertClients = game.ReplicatedStorage.ServerMessage
local MarketPlaceService = game:GetService("MarketplaceService")

local gamepassId = 251841658
local strengthPass = 251310188
local endPass = 251310008

local mults = require(game.ServerStorage.classMults)

local function ownsgamepass(userId, gamepassId)
	local ownsGamepass
	local s,res = pcall(function()
		ownsGamepass = MarketPlaceService:UserOwnsGamePassAsync(userId, gamepassId)
	end)

	return ownsGamepass
end
event.OnServerEvent:Connect(function(player, stat, val, op)
	local value = val -- to not alter original value
	local owns = ownsgamepass(player.UserId, gamepassId)
	if (stat == "Strength" and ownsgamepass(player.UserId, strengthPass))
		or (stat == "Endurance" and ownsgamepass(player.UserId, endPass)) then
		value *= 2
	end
	if stat.ClassName ~= "StringValue" and type(value)~='number' then
		warn("value is not number. the value is", value, "the stat is", stat)
	end
	if op == "+" then
		if owns then
			player:WaitForChild(stat).Value += value * 2
		else
			player:WaitForChild(stat).Value += value
		end
	elseif op == "set" then
		if owns and not stat:match("Multi") then
			--print(value)
			player:WaitForChild(stat).Value = value * 2
		else
			player:WaitForChild(stat).Value = value
		end
		if val:match("Class") then
			alertClients:FireAllClients(player.Name.." has ranked up to "..value.."!") -- doesn't need player to send to
		end
	end
end)

I think that one is the GUI script, did you send that?

This is an add-on stat that you corrected me all the time

Not that one, that was on the server, I meant the local client script in the user interface buttons that sends the request to buy the stat. Unless I misunderstood.

And through what does the player buy a class, that is, a buy button?

Yes, the buy button, but I thought it was implemented already

is there a separate code?

right now I’ll send it to you, let’s finish it today, otherwise 2 days have already passed

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

script.Parent.MouseButton1Click:Connect(function()
	if name.Text == "D-Class" and class.Value ~= "D-Class" then
		if tp.Value >= 50 then
			setClass:FireServer("Class", "D-Class", "set")
			reset:FireServer()
		end
	end
end)