Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix leader stat handling #1719

Merged
merged 1 commit into from
Nov 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions MainModule/Server/Commands/Moderators.luau
Original file line number Diff line number Diff line change
Expand Up @@ -4948,13 +4948,13 @@ return function(Vargs, env)
for _, v in service.GetPlayers(plr, args[1], { NoFakePlayer = true }) do
local leaderstats = v:FindFirstChild("leaderstats")
if leaderstats then
local absoluteMatch = leaderstats:FindFirstChild(statName)
if absoluteMatch and absoluteMatch:IsA("ValueBase") then
absoluteMatch.Value = args[3]
local absolute = leaderstats:FindFirstChild(statName)
if absolute and absolute:IsA("ValueBase") then
absolute.Value = (absolute:IsA("IntValue") or absolute:IsA("NumberValue")) and tonumber(args[3]) or args[3]
else
for _, st in leaderstats:GetChildren() do
if st:IsA("ValueBase") and string.match(st.Name:lower(), `^{statName:lower()}`) then
st.Value = args[3]
if st:IsA("ValueBase") and string.match(st.Name:lower(), `^{service.SanitizePattern(statName:lower())}`) then
st.Value = (st:IsA("IntValue") or st:IsA("NumberValue")) and tonumber(args[3]) or args[3]
end
end
end
Expand Down Expand Up @@ -4983,7 +4983,7 @@ return function(Vargs, env)
absoluteMatch:Destroy()
else
for _, st in leaderstats:GetChildren() do
if (st:IsA("IntValue") or st:IsA("NumberValue")) and string.match(st.Name:lower(), `^{statName:lower()}`) then
if (st:IsA("IntValue") or st:IsA("NumberValue")) and string.match(st.Name:lower(), `^{service.SanitizePattern(statName:lower())}`) then
st:Destroy()
end
end
Expand Down Expand Up @@ -5052,7 +5052,7 @@ return function(Vargs, env)
absoluteMatch.Value += valueToAdd
else
for _, st in leaderstats:GetChildren() do
if (st:IsA("IntValue") or st:IsA("NumberValue")) and string.match(st.Name:lower(), `^{statName:lower()}`) then
if (st:IsA("IntValue") or st:IsA("NumberValue")) and string.match(st.Name:lower(), `^{service.SanitizePattern(statName:lower())}`) then
st.Value += valueToAdd
end
end
Expand Down Expand Up @@ -5081,7 +5081,7 @@ return function(Vargs, env)
absoluteMatch.Value -= valueToSubtract
else
for _, st in leaderstats:GetChildren() do
if (st:IsA("IntValue") or st:IsA("NumberValue")) and string.match(st.Name:lower(), `^{statName:lower()}`) then
if (st:IsA("IntValue") or st:IsA("NumberValue")) and string.match(st.Name:lower(), `^{service.SanitizePattern(statName:lower())}`) then
st.Value -= valueToSubtract
end
end
Expand Down
Loading