Ok, that is all I needed, so it was a problem with the server.
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 typeof(value)=="number" and 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)
try that on the server side, see if the error shows.