Body Scaling Effect with R6

I created a script that tweens you to be bigger when you click a button. I want it to have the same effect but would like to port it to a R6 game.

The Effect

R15 Code
	local values = {
		height = {Value = char.BodyHeightScale.Value * 2.5},
		depth = {Value = char.BodyDepthScale.Value * 2.5},
		width = {Value = char.BodyWidthScale.Value * 2.5},
		head = {Value = char.HeadScale.Value * 2.5}
	}

	local tweens = {
		heightTween = tweenService:Create(char.BodyHeightScale, tweenInfo, values.height),
		depthTween = tweenService:Create(char.BodyDepthScale, tweenInfo, values.depth),
		widthTween = tweenService:Create(char.BodyWidthScale, tweenInfo, values.width),
		headTween = tweenService:Create(char.HeadScale, tweenInfo, values.head)
	}	
		
	for _, tween in pairs(tweens) do
		tween:Play()
	end
My R6 Code
plr.Character.Humanoid.AutomaticScalingEnabled = true

	
local values = {
	height = {Value = char.HeightScale.Value * 2.5},
	depth = {Value = char.DepthScale.Value * 2.5},
	width = {Value = char.WidthScale.Value * 2.5},
	head = {Value = char.HeadScale.Value * 2.5}
}

local tweens = {
	heightTween = tweenService:Create(char.HeightScale, tweenInfo, values.height),
	depthTween = tweenService:Create(char.DepthScale, tweenInfo, values.depth),
	widthTween = tweenService:Create(char.WidthScale, tweenInfo, values.width),
	headTween = tweenService:Create(char.Scale, tweenInfo, values.head)
}	
		
for _, tween in pairs(tweens) do
	tween:Play()
end
Current R6 Code Output

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.

1 Like

(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

ScaleTo is currently a studio only feature (sadly enough)

well damn then seems like there is no other way unless you scalethe character andk killing him in the process

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)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.