I’m having an issue where this command isn’t working in live games only. In Studio, I can create the “Number” leaderstat perfectly fine, but not in a live game. (I published and made new servers just in case.) Every other data type works (string, integer, boolean) but not number. This is really strange to me.
Here’s what it looks like in a studio
And in a live game:
Here’s the code for the command.
MakeStat = {
Prefix = Settings.Prefix;
Commands = {"makestat";"leaderstat";"stat";};
Args = {"player";"stat";"type(string/number/int/bool)";"value"};
Filter = true;
Description = "Add a statistic to <player> which displays in the leaderboard and can be changed with :setstat.\nUse the 'type' parameter to determine the type of stat.";
AdminLevel = "Moderators";
Function = function(plr,args)
local sName = logic:get(plr,args[2],"") or "Stat"
local sType = logic:get(plr,args[3],"") or "int"
for i,v in pairs(logic:get(plr,args[1],plr)) do
if not v:FindFirstChild("leaderstats") then
local leaderstats = Instance.new("Folder",v)
leaderstats.Name = "leaderstats"
end
local leaderstats = v:FindFirstChild("leaderstats")
if leaderstats then
if leaderstats:FindFirstChild("sName") then return end
if sType == "string" then
local stat = Instance.new("StringValue")
stat.Name = sName
stat.Value = logic:get(plr,args[4],"") or "Value"
stat.Parent = leaderstats
end
if sType == "number" then
print("type number detected")
local stat = Instance.new("NumberValue")
stat.Name = sName
stat.Value = logic:get(plr,args[4],0) or 0
stat.Parent = leaderstats
print("made it")
end
if sType == "int" then
local stat = Instance.new("IntValue")
stat.Name = sName
stat.Value = logic:get(plr,args[4],0) or 0
stat.Parent = leaderstats
end
if sType == "bool" then
local stat = Instance.new("BoolValue")
stat.Name = sName
stat.Value = logic:get(plr,args[4],true) or false
stat.Parent = leaderstats
end
end
end
end
};


