Attempt to perform arithmetic (mul) on number and string

game.Players.PlayerAdded:Connect(function(player)
    
	local stats = Instance.new("Folder",player)
	stats.Name = "leaderstats"

	local Title = Instance.new("StringValue",stats)
	Title.Name = "Status"
	Title.Value = "Innocent"

	local Streak = Instance.new("IntValue", stats)
	Streak.Name = "Killstreak"
	Streak.Value = 0

	local Rep = Instance.new("NumberValue", player)
	Rep.Name = "Reputation"
	Rep.Value = 0

	local Class = Instance.new("StringValue", stats)
	Class.Name = "Class"
	Class.Value = "F-Class"

	local BestFusion = Instance.new("Folder", player)
	BestFusion.Name = "BestFusion"

	local bestFusionName = Instance.new("StringValue", stats)
	bestFusionName.Name = "Fusion"
	bestFusionName.Value = "None"

	local bestFusionMult = Instance.new("IntValue", BestFusion)
	bestFusionMult.Name = "FusionMulti"
	bestFusionMult.Value = 1

	local coins = Instance.new("NumberValue", player)
	coins.Name = "Coins"
	coins.Value = 0

	local totalCoins = Instance.new("NumberValue", player)
	totalCoins.Name = "TotalCoins"
	totalCoins.Value = 0

	local strength = Instance.new("NumberValue", player)
	strength.Name = "Strength"
	strength.Value = 0

	local agility = Instance.new("NumberValue", player)
	agility.Name = "Agility"
	agility.Value = 0

	local psp = Instance.new("NumberValue", player)
	psp.Name = "Psp"
	psp.Value = 0

	local Mult  = Instance.new("NumberValue", player)
	Mult.Name = "Multi"
	Mult.Value = 1

	local eMult  = Instance.new("NumberValue", player)
	eMult.Name = "eMulti"
	eMult.Value = 1

script classMult in ServerStorage module script

local classMults = {}
classMults.fClass = 2
classMults.eClass = 5
classMults.dClass = 20
classMults.cClass = 100
classMults.bClass = 500
classMults.aClass = 2500
classMults.sClass = 12500
classMults.ssClass = 150000
classMults.sssClass = 1500000
classMults.xClass = 30000000
classMults.yClass = 1000000000
classMults.zClass = 40000000000
classMults.xyzClass = 400000000000
return classMults

What is the endurance value for and what is it supposed to be?
For some reason you have the class value in there which is a string value and not a number
endurance.Value = endurance + 1000 *tonumber(class)*tonumber(eMulti)

Classes are boost, that is, like rebirth, when you buy rebirth, you get 2 powers, then 4,endurance plays a role here, like when you stand on a part and you get a boost from it

Haha I got you now, I think.

Try this script


local Player = game:GetService("Players")

local classMults = require(reference the class mults module)

local playersInside = {}

script.Parent.Touched:Connect(function(hit)
    if hit.Name ~= "HumanoidRootPart" then return end

    local player = Player:GetPlayerFromCharacter(hit.Parent)
    if not player then return end

    local strength = player:FindFirstChild("Strength")
    local eMulti = player.eMulti.Value
    local class = player.leaderstats.Class.Value
    if not strength or strength.Value < 100 then return end

    table.insert(playersInside, player)
    while table.find(playersInside, player) do
        wait(2)
        if not table.find(playersInside, player) then return end
        local endurance = player:FindFirstChild("Endurance")
        if endurance then
            endurance.Value = endurance + 1000 * classMults[class] * tonumber(eMulti)
        end
    end
end)

script.Parent.TouchEnded:Connect(function(hit)
    if hit.Name ~= "HumanoidRootPart" then return end

    local player = Player:GetPlayerFromCharacter(hit.Parent)
    if not player then return end

    local playerIndex = table.find(playersInside, player)
    if playerIndex then
        table.remove(playersInside, playerIndex)
    end
end)

Workspace.Endurance.Script:24: attempt to perform arithmetic (mul) on number and nil - Server - Script:24

In your leaderstats script can you change

This:
local Class = Instance.new("StringValue", stats)
Class.Name = "Class"
Class.Value = "F-Class"

To this:
local Class = Instance.new("StringValue", stats)
Class.Name = "Class"
Class.Value = "fClass"

Workspace.Endurance.Script:23: attempt to perform arithmetic (add) on Instance and number - Server - Script:23

and my game is broken, let’s not change it?

Here:
endurance.Value = endurance.Value + 1000 * classMults[class] * tonumber(eMulti)

Well whatever other scripts use the class thing you’ll have to adjust those otherwise I don’t think there’s any other way.

That class value must match with any one of these
local classMults = {}
classMults.fClass = 2
classMults.eClass = 5
classMults.dClass = 20
classMults.cClass = 100
classMults.bClass = 500
classMults.aClass = 2500
classMults.sClass = 12500
classMults.ssClass = 150000
classMults.sssClass = 1500000
classMults.xClass = 30000000
classMults.yClass = 1000000000
classMults.zClass = 40000000000
classMults.xyzClass = 400000000000
return classMults

I have a topic here, help there Crèche, you have a hard time here

I don’t understand how changing

“F-Class” to fClass breaks the script? None of those 2 scripts in that post contains anything with the class value

I have more than 100 scripts in the game

Well list any of the errors or warnings that say anything about the class value