So I was making a script where It’d scale the NPC head. Sadly it doesn’t work. I currently want it to work in a Local-Script. I’ve tried to use the Value of the Humanoid “HeadScale” but it appears it only works on Server-Scripts.
Here is the code:
local targetSize = Character:WaitForChild("Head").Size * 2
local tween = TweenService:Create(Character:WaitForChild("Head"), TweenInfo.new(length), {Size = targetSize})
tween:Play()
I do not know If It helps you, but I will still try:
In your case, the code you have would actually work in a ServerScript, if you wanted to scale a part not associated with a player character:
local Character = workspace:WaitForChild("PartName") -- Replace with the part's name.
local TweenService = game:GetService("TweenService")
local targetSize = Character.Size * 2
local tween = TweenService:Create(Character, TweenInfo.new(5), {Size = targetSize}) -- Change the length to the desired duration in seconds.
tween:Play()
But if you want to scale a player character’s head, it would be better to use a ServerScript and the Humanoid’s “HeadScale” property:
local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local humanoid = Character:WaitForChild("Humanoid")
humanoid.HeadScale = 2
This code should be placed in a server-side script, as changes made in a LocalScript will not be seen by others due to FilteringEnabled.
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")
local finalSize = Vector3.new(3, 3, 3) -- End size
local animSpeed = 5 -- Time it takes to finish head growth
local loops = 60 -- Think of in context of frames
local increment = (finalSize - Head.Size) / loops
for i = 1, loops do
Head.Size = Head.Size + increment
task.wait(animSpeed/loops)
end
Messed around with this and the body and come to the conclusion this is never going to be perfect with a R6 body. However, I can change the R15 body’s everything to any size you wish perfectly and everything will always line up and work as intended.
Change mass (the 1.5) to whatever you wish. Lower than 1 = smaller. Higher than 1 = larger.
Set this up on touch so you can quickly test it. Mark sure setting are set to R15 in game options.
--Inside a part on the workspace with CanTouch
local db, mass = true, 1.5
local Depth, Height, Width = mass, mass, mass
local Vector = Vector3.new(Width, Height, Depth)
script.Parent.Touched:Connect(function(Hit)
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player == nil then return end
if db == true then db = false
local Humanoid = Player.Character.Humanoid
Player.Character:SetAttribute("Scaled", true)
if Humanoid.RigType == Enum.HumanoidRigType.R15 then
local HD = Humanoid:GetAppliedDescription()
HD.DepthScale *= Depth
HD.HeightScale *= Height
HD.WidthScale *= Width
HD.HeadScale *= math.max(Width, Depth)
Humanoid:ApplyDescription(HD)
end task.wait(3) db = true
end
end)```