diff --git a/MainModule/Server/Commands/Fun.luau b/MainModule/Server/Commands/Fun.luau index 93715fec6..d06df6b2f 100644 --- a/MainModule/Server/Commands/Fun.luau +++ b/MainModule/Server/Commands/Fun.luau @@ -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 "; - 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"}; diff --git a/MainModule/Server/Commands/Moderators.luau b/MainModule/Server/Commands/Moderators.luau index af76d904f..748602c36 100644 --- a/MainModule/Server/Commands/Moderators.luau +++ b/MainModule/Server/Commands/Moderators.luau @@ -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 "; + 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"};