I want to make a in game level where players can turn tiny by touching a part
How would I shrink the players character and make them tiny?
I want to make a in game level where players can turn tiny by touching a part
How would I shrink the players character and make them tiny?
I know a way to shrink Players, but it’s R15, if you want to know, tell me.
This script may help.
local part = game.Workspace.Part -- Your part to touch
local value = 0.3
function onTouched(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
hum.HeadScale.Value = value
hum.BodyDepthScale.Value = value
hum.BodyHeightScale.Value = value
hum.BodyWidthScale.Value = value
end
end
part.Touched:Connect(onTouched)
Well i’ve actually done something like that before, and it probably works for r6,r15 and custom rigs, here’s my approach on it:
function dividecframe(x,yv)
local x, y, z, m11, m12, m13, m21, m22, m23, m31, m32, m33 = x:components()
return CFrame.new(x*yv, y*yv, z*yv, m11*yv, m12*yv, m13*yv, m21*yv, m22*yv, m23*yv, m31*yv, m32*yv, m33*yv)
end
function resize(play,yv)
for _,v in pairs(play.Character:GetDescendants()) do
if v:IsA("BasePart") then v.Size=v.Size*yv
elseif v:IsA("Motor6D") then
v.C0=dividecframe(v.C0,yv) v.C1=dividecframe(v.C1,yv)
elseif v:IsA("FileMesh") or v:IsA("SpecialMesh") then
if v.Parent.Name=="Head" then
if v.MeshId=="rbxasset://avatar/heads/headB.mesh" then
v.Scale=v.Scale*(yv)
else
v.Scale=v.Scale*(yv/yv)
end
else
v.Scale=v.Scale*(yv) end
elseif v:IsA("Weld") then v.C0=dividecframe(v.C0,yv) v.C1=dividecframe(v.C1,yv) end
end
end
What happens here is, it changes the parts size and also the joints motors cframes to the chosen multiplier that way not only the size changes but animations also adapt to it.
Usage is
resize(player,multiplier) --ex "2" multiplier means twice the current size
local part = workspace:WaitForChild("Part")
local value = 0.5 --change to how you want to scale the player's character (currently half size is used)
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then --is a humanoid
local hum = hit.Parent:WaitForChild("Humanoid")
local humDesc = hum:WaitForChild("HumanoidDescription")
humDesc.BodyTypeScale.Value *= value
humDesc.DepthScale.Value *= value
humDesc.HeadScale.Value *= value
humDesc.HeightScale.Value *= value
humDesc.ProportionScale.Value *= value
humDesc.WidthScale.Value *= value
hum.HipHeight *= value
end
end)
Those properties belong to the HumanoidDescription instance which is a child of the Humanoid instance, not the Humanoid instance itself.