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

Convert size to a non fun command #1828

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
88 changes: 0 additions & 88 deletions MainModule/Server/Commands/Fun.luau
Original file line number Diff line number Diff line change
Expand Up @@ -3708,94 +3708,6 @@ return function(Vargs, env)
end
};

Resize = {
Prefix = Settings.Prefix;
Commands = {"resize", "size", "scale"};
Args = {"player", "mult"};
Description = "Resize the target player(s)'s character by <mult>";
Fun = true;
AdminLevel = "Moderators";
Function = function(plr: Player, args: {string})
local num = math.clamp(tonumber(args[2]) or 1, 0.001, Variables.SizeLimit) -- Size limit exceeding over 20 would be unnecessary and may potientially create massive lag !!

if not args[2] or not tonumber(args[2]) then
num = 1
Functions.Hint("Size changed to 1 [Argument #2 (size multiplier) wasn't supplied correctly.]", {plr})
elseif tonumber(args[2]) and tonumber(args[2]) > Variables.SizeLimit then
Functions.Hint(`Size changed to the maximum {num} [Argument #2 (size multiplier) went over the size limit]`, {plr})
end

local function fixDensity(char)
for _, charPart in char:GetChildren() do
if charPart:IsA("MeshPart") or charPart:IsA("Part") then
local defaultprops = PhysicalProperties.new(charPart.Material)
local density = defaultprops.Density / char:GetAttribute("Adonis_Resize") ^ 3

charPart.CustomPhysicalProperties = PhysicalProperties.new(density, defaultprops.Friction, defaultprops.Elasticity)
end
end
end

for _, v in service.GetPlayers(plr, args[1]) do
local char = v.Character
local human = char and char:FindFirstChildOfClass("Humanoid")

if not human then
Functions.Hint(`Cannot resize {service.FormatPlayer(v)}'s character: humanoid and/or character doesn't exist!`, {plr})
continue
end

local resizeAttributeValue = char:GetAttribute("Adonis_Resize")
if not resizeAttributeValue then
char:SetAttribute("Adonis_Resize", num)
elseif resizeAttributeValue * num < Variables.SizeLimit then
char:SetAttribute("Adonis_Resize", resizeAttributeValue * num)
else
Functions.Hint(string.format("Cannot resize %s's character by %g%%: size limit exceeded.", service.FormatPlayer(v), num*100), {plr})
continue
end

if human and char:IsA("Model") then
char:ScaleTo(num)
elseif human and human.RigType == Enum.HumanoidRigType.R15 then
for _, val in human:GetChildren() do
if val:IsA("NumberValue") and val.Name:match(".*Scale") then
val.Value *= num
end
end
fixDensity(char)
elseif human and human.RigType == Enum.HumanoidRigType.R6 then
local motors = {}
table.insert(motors, char.HumanoidRootPart:FindFirstChild("RootJoint"))
for _, motor in char.Torso:GetChildren() do
if motor:IsA("Motor6D") then table.insert(motors, motor) end
end
for _, motor in motors do
motor.C0 = CFrame.new((motor.C0.Position * num)) * (motor.C0 - motor.C0.Position)
motor.C1 = CFrame.new((motor.C1.Position * num)) * (motor.C1 - motor.C1.Position)
end

for _, v in char:GetDescendants() do
if v:IsA("BasePart") then
v.Size *= num
elseif v:IsA("Accessory") and v:FindFirstChild("Handle") then
local handle = v.Handle
handle.AccessoryWeld.C0 = CFrame.new((handle.AccessoryWeld.C0.Position * num)) * (handle.AccessoryWeld.C0 - handle.AccessoryWeld.C0.Position)
handle.AccessoryWeld.C1 = CFrame.new((handle.AccessoryWeld.C1.Position * num)) * (handle.AccessoryWeld.C1 - handle.AccessoryWeld.C1.Position)
local mesh = handle:FindFirstChildOfClass("SpecialMesh")
if mesh then
mesh.Scale *= num
end
elseif v:IsA("SpecialMesh") and v.Parent.Name ~= "Handle" and v.Parent.Name ~= "Head" then
v.Scale *= num
end
end
fixDensity(char)
end
end
end
};

Seizure = {
Prefix = Settings.Prefix;
Commands = {"seizure", "seize"};
Expand Down
88 changes: 88 additions & 0 deletions MainModule/Server/Commands/Moderators.luau
Original file line number Diff line number Diff line change
Expand Up @@ -4075,6 +4075,94 @@ return function(Vargs, env)
end
};

Resize = {
Prefix = Settings.Prefix;
Commands = {"resize", "size", "scale"};
Args = {"player", "mult"};
Description = "Resize the target player(s)'s character by <mult>";
Fun = true;
AdminLevel = "Moderators";
Function = function(plr: Player, args: {string})
local num = math.clamp(tonumber(args[2]) or 1, 0.001, Variables.SizeLimit) -- Size limit exceeding over 20 would be unnecessary and may potientially create massive lag !!

if not args[2] or not tonumber(args[2]) then
num = 1
Functions.Hint("Size changed to 1 [Argument #2 (size multiplier) wasn't supplied correctly.]", {plr})
elseif tonumber(args[2]) and tonumber(args[2]) > Variables.SizeLimit then
Functions.Hint(`Size changed to the maximum {num} [Argument #2 (size multiplier) went over the size limit]`, {plr})
end

local function fixDensity(char)
for _, charPart in char:GetChildren() do
if charPart:IsA("MeshPart") or charPart:IsA("Part") then
local defaultprops = PhysicalProperties.new(charPart.Material)
local density = defaultprops.Density / char:GetAttribute("Adonis_Resize") ^ 3

charPart.CustomPhysicalProperties = PhysicalProperties.new(density, defaultprops.Friction, defaultprops.Elasticity)
end
end
end

for _, v in service.GetPlayers(plr, args[1]) do
local char = v.Character
local human = char and char:FindFirstChildOfClass("Humanoid")

if not human then
Functions.Hint(`Cannot resize {service.FormatPlayer(v)}'s character: humanoid and/or character doesn't exist!`, {plr})
continue
end

local resizeAttributeValue = char:GetAttribute("Adonis_Resize")
if not resizeAttributeValue then
char:SetAttribute("Adonis_Resize", num)
elseif resizeAttributeValue * num < Variables.SizeLimit then
char:SetAttribute("Adonis_Resize", resizeAttributeValue * num)
else
Functions.Hint(string.format("Cannot resize %s's character by %g%%: size limit exceeded.", service.FormatPlayer(v), num*100), {plr})
continue
end

if human and char:IsA("Model") then
char:ScaleTo(num)
elseif human and human.RigType == Enum.HumanoidRigType.R15 then
for _, val in human:GetChildren() do
if val:IsA("NumberValue") and val.Name:match(".*Scale") then
val.Value *= num
end
end
fixDensity(char)
elseif human and human.RigType == Enum.HumanoidRigType.R6 then
local motors = {}
table.insert(motors, char.HumanoidRootPart:FindFirstChild("RootJoint"))
for _, motor in char.Torso:GetChildren() do
if motor:IsA("Motor6D") then table.insert(motors, motor) end
end
for _, motor in motors do
motor.C0 = CFrame.new((motor.C0.Position * num)) * (motor.C0 - motor.C0.Position)
motor.C1 = CFrame.new((motor.C1.Position * num)) * (motor.C1 - motor.C1.Position)
end

for _, v in char:GetDescendants() do
if v:IsA("BasePart") then
v.Size *= num
elseif v:IsA("Accessory") and v:FindFirstChild("Handle") then
local handle = v.Handle
handle.AccessoryWeld.C0 = CFrame.new((handle.AccessoryWeld.C0.Position * num)) * (handle.AccessoryWeld.C0 - handle.AccessoryWeld.C0.Position)
handle.AccessoryWeld.C1 = CFrame.new((handle.AccessoryWeld.C1.Position * num)) * (handle.AccessoryWeld.C1 - handle.AccessoryWeld.C1.Position)
local mesh = handle:FindFirstChildOfClass("SpecialMesh")
if mesh then
mesh.Scale *= num
end
elseif v:IsA("SpecialMesh") and v.Parent.Name ~= "Handle" and v.Parent.Name ~= "Head" then
v.Scale *= num
end
end
fixDensity(char)
end
end
end
};

StarterRemove = {
Prefix = Settings.Prefix;
Commands = {"starterremove"};
Expand Down
Loading