Closer you are to a part the smaller you get

So i want to make a part and the closer you the smaller you get but if your 50 studs away you will be regular sized

local Players = game:GetService("Players")
----------/
local MathClamp = math.clamp
----------/
local HumanoidRoot = script.Parent.PrimaryPart

local GetPlayerCharacter = function()
	for _, v in pairs(Players:GetPlayers()) do
		if v.Character then
			local Distance = v:DistanceFromCharacter(HumanoidRoot.Position)
			local ClampedDistance = MathClamp(Distance, 0, 1)
			local Humanoid = v.Character.Humanoid
			local HS = Humanoid.HeadScale
			local BDS = Humanoid.BodyDepthScale
			local BWS = Humanoid.BodyWidthScale
			local BHS = Humanoid.BodyHeightScale
			
			local Final = math.abs(ClampedDistance)*-1.
			BHS.Value = Final
			BWS.Value = Final
			HS.Value = Final
			BDS.Value = Final
		end
	end
end

while wait() do
	GetPlayerCharacter()
end
``` i have tired this

What’s the issue? Any errors in console?

Maybe try
(Char.HumanoidRootPart.Position-Part.Position).Magnitude

1 Like