I’ll probably use this for a puzzle game since it supports R6. Pretty much all of my games are R6 and most resources only support R15, so this is a nice change of pace, great work!
I looked over the source code and I want to know why your used:
local module = {}
module.__index = module
Instead of:
local module = {}
I only do the former option when I’m making a module with OOP, and I want to know why you did it when your module isn’t using OOP. Just for clarification, I know very little about metamethods, and I only really use __index.
I do that all the time, for no real reason other than to make me look smarter. (But not with metamethod since I have no clue what I am doing when I use them).
local module = {}
module.__index = module
function module.ResizeCharacter(givenModel,scale)
local Humanoid = givenModel:FindFirstChild("Humanoid")
if Humanoid then
if Humanoid.RigType == Enum.RigType.R15 then
if Humanoid:FindFirstChild("HeadScale") then
local HS = Humanoid.HeadScale
local BDS = Humanoid.BodyDepthScale
local BWS = Humanoid.BodyWidthScale
local BHS = Humanoid.BodyHeightScale
HS.Value = HS.Value * scale
BDS.Value = BDS.Value * scale
BWS.Value = BWS.Value * scale
BHS.Value = BHS.Value * scale
else
error("Not compatible character (BodyScale missing)")
return
end
else
local halfHMRSize = (givenModel.HumanoidRootPart.Size.Y / 2)
for _, i in pairs(givenModel:GetDescendants()) do
if i:IsA("BasePart") and i.Name ~= "HumanoidRootPart" then
local wasCanCollide = i.CanCollide
i.CanCollide = false
i.Size = i.Size * scale
i.CanCollide = wasCanCollide
elseif i:IsA("FileMesh") and (not i:IsA("SpecialMesh") or i.MeshType == Enum.MeshType.FileMesh) then
i.Scale = i.Scale * scale
elseif i:IsA("JointInstance") then
local wasAnchored = i.Part1.Anchored
i.Part1.Anchored = false
i.C0 = i.C0 - (i.C0.p * (1 - scale))
i.C1 = i.C1 - (i.C1.p * (1 - scale))
elseif i:IsA("Attachment") then
i.Position = i.Position * scale
elseif i:IsA("Pose") then
i.CFrame = i.CFrame - (i.CFrame.p * (1 - scale))
elseif i:IsA("Humanoid") then
i.HipHeight = (i.HipHeight + halfHMRSize) * scale - halfHMRSize
end
end
end
end
end
The r15 resizer is nothing special (it uses the usual resizing method for r15)
The r6 resizes each part and scales each mesh. The module also changes pose cframe,attachments cframe,Joints cframe and sets humanoid hip height
Is there a way it could be made where it only extends the Height. Making it look like its getting taller instead of over-all changing its width and depth.