Is it simply not possible to do this with R6 avatars? I want to avoid using a series of preset sizes and ApplyDescription/GetApplieDescription in order to maintain the smooth look.
(READ 6TH REPLY FOR ANSWER) You can call :ScaleTo on the character
(Heads up, just remembered that this is currently a studio only beta)
local TweenService = game:GetService("TweenService")
local NumberValue = Instance.new("NumberValue")
local Character = plr.Character
local DesiredHeight = 2
local Tween = TweenService:Create(NumberValue, tweenInfo, {Value = DesiredHeight})
local Connections = {}
table.insert(Connections, NumberValue.Changed:Connect(function()
Character:ScaleTo(NumberValue.Value)
end))
table.insert(Connections, Tween.Completed:Connect(function()
for _,Connection in ipairs(Connections) do
Connection:Disconnect()
end
table.clear(Connections)
NumberValue:Destroy()
end))
Tween:Play()
it is probably because the scale values does not exist on r6 you can just do what @Haydz6 said.
local boi = workspace.Dummy
local num = Instance.new("NumberValue")
local service = game:GetService("TweenService")
num.Value = 1
local goal = {Value = 2.5}
local info = TweenInfo.new(1--[[info]])
local tween = service:Create(num,info,goal)
tween:Play()
num.Changed:Connect(function()
boi:ScaleTo(num.Value)
end)
tween.Completed:Connect(function()
num:Destroy()
end)
something like that
its not like proper code but you can edit it
Here is a solution that does not use the ScaleTo beta feature
You should be able to call ScaleCharacter(PreferredSize)
local TweenService = game:GetService("TweenService")
local function ScaleCharacter(DesiredHeight: number)
local Character = plr.Character
local NumberValue = Character:FindFirstChild("SizeTween")
if not NumberValue then
NumberValue = Instance.new("NumberValue")
NumberValue.Name = "SizeTween"
NumberValue.Parent = Character
NumberValue.Value = Character:GetAttribute("CurrentSize") or 1
end
local Tween = TweenService:Create(NumberValue, TweenInfo.new(5), {Value = DesiredHeight})
local Connections = {}
local function ScaleTo(Size)
local PartSize = Vector3.new(Size, Size, Size)
local CurrentSize = Character:GetAttribute("CurrentSize") or 1
local CurrentVector = Vector3.new(CurrentSize, CurrentSize, CurrentSize)
local Humanoid = Character.Humanoid
local function AdjustMotor(Motor: Motor6D)
local DefaultC0 = CFrame.new((Motor.C0.Position / CurrentVector)) * (Motor.C0 - Motor.C0.Position)
local DefaultC1 = CFrame.new((Motor.C1.Position / CurrentVector)) * (Motor.C1 - Motor.C1.Position)
Motor.C0 = CFrame.new((DefaultC0.Position * PartSize)) * (DefaultC0 - DefaultC0.Position)
Motor.C1 = CFrame.new((DefaultC1.Position * PartSize)) * (DefaultC1 - DefaultC1.Position)
end
AdjustMotor(Character.HumanoidRootPart.RootJoint)
for _,Motor in ipairs(Character.Torso:GetChildren()) do
if Motor:IsA("Motor6D") then
AdjustMotor(Motor)
end
end
for _,Part in ipairs(Character:GetDescendants()) do
if Part:IsA("BasePart") then
Part.Size = (Part.Size / CurrentVector) * PartSize
elseif Part:IsA("Accessory") then
local Handle = Part.Handle
local AccessoryWeld = Handle.AccessoryWeld
local DefaultC0 = CFrame.new((AccessoryWeld.C0.Position / CurrentVector)) * (AccessoryWeld.C0 - AccessoryWeld.C0.Position)
local DefaultC1 = CFrame.new((AccessoryWeld.C1.Position / CurrentVector)) * (AccessoryWeld.C1 - AccessoryWeld.C1.Position)
AccessoryWeld.C0 = CFrame.new((DefaultC0.Position * PartSize)) * (DefaultC0 - DefaultC0.Position)
AccessoryWeld.C1 = CFrame.new((DefaultC1.Position * PartSize)) * (DefaultC1 - DefaultC1.Position)
local SpecialMesh = Handle:FindFirstChildOfClass("SpecialMesh")
SpecialMesh.Scale = (SpecialMesh.Scale / CurrentVector) * PartSize
end
end
Character:SetAttribute("CurrentSize", Size)
end
table.insert(Connections, NumberValue.Changed:Connect(function()
ScaleTo(NumberValue.Value)
end))
table.insert(Connections, Tween.Completed:Connect(function()
for _,Connection in ipairs(Connections) do
Connection:Disconnect()
end
table.clear(Connections)
NumberValue:Destroy()
end))
Tween:Play()
end
ScaleCharacter(5)