So i was searching for a way to resize Player character, seems i found it out, I used this module , everything works fine, until i need to resize character small again
modulescript :
local Players = game:GetService("Players")
local module = {}
module.defaultWait = 5
function module.R6Scale(character, multiplier)
local function ApplyMotorScale(motor)
local pos0, pos1 = motor.C0.Position, motor.C1.Position
motor.C0 = CFrame.new((pos0 * multiplier)) * (motor.C0 - pos0)
motor.C1 = CFrame.new((pos1 * multiplier)) * (motor.C1 - pos1)
end
ApplyMotorScale(character.HumanoidRootPart.RootJoint)
for i, motor in pairs(character.Torso:GetChildren()) do
if motor:IsA("Motor6D") then
ApplyMotorScale(motor)
end
end
for i, part in pairs(character:GetChildren()) do
if part:IsA("BasePart") then
part.Size *= multiplier
end
end
local player = Players:GetPlayerFromCharacter(character)
if player then
--wait for their accessories to load
local loaded = player:HasAppearanceLoaded() or player.CharacterAppearanceLoaded:Wait()
end
for i, accessory in pairs(character:GetChildren()) do
if not accessory:IsA("Accessory") then continue end
local Handle = accessory:FindFirstChild("Handle")
if not Handle then continue end
local aw = Handle:FindFirstChild("AccessoryWeld")
if not aw then continue end
aw.C0 = CFrame.new((aw.C0.Position * multiplier)) * (aw.C0 - aw.C0.Position)
aw.C1 = CFrame.new((aw.C1.Position * multiplier)) * (aw.C1 - aw.C1.Position)
local sm = Handle:FindFirstChildOfClass("SpecialMesh")
if not sm then continue end
sm.Scale *= multiplier
end
end
function module.R15Scale(character, multiplier, waitTimeout)
waitTimeout = waitTimeout or module.defaultWait
local humanoid = character:FindFirstChild("Humanoid")
if not humanoid then warn("Humanoid wasn't found") return end
local scales = {"HeadScale", "BodyDepthScale", "BodyWidthScale", "BodyHeightScale"}
for _, scale in pairs(scales) do
local object = humanoid:WaitForChild(scale, waitTimeout)
if not object then warn(scale.." wasn't found") continue end
object.Value *= multiplier
end
end
function module.Scale(character, multiplier, waitTimeout)
waitTimeout = waitTimeout or module.defaultWait
local humanoid = character:WaitForChild("Humanoid", waitTimeout)
if humanoid.RigType == Enum.HumanoidRigType.R15 then
module.R15Scale(character, multiplier, waitTimeout)
else
module.R6Scale(character, multiplier)
end
end
return module
Some other script :
local replicated = game:GetService("ReplicatedStorage")
local modules = replicated:WaitForChild("Modulos")
local sizeModule = require(modules:WaitForChild("MainModuleR"))
script.Parent.OnServerEvent:Connect(function(plr)
local Player = plr
local char = plr.Character
sizeModule.ResizeCharacter(char, 5)
task.wait(1)
sizeModule.ResizeCharacter(char, 1) -- Doesnt works
print("Yes") -- but it prints
end)
I even tried many resize modules and is the same result, no error no warnings
Game is R6