Trying to lerp frame transparency correctly

i saw in games where when u get close to your own plot, the plot name tag tends to disappear.

at the moment i have some sort of system in place but the BackgroundTransparency on my frame only goes to something like 0.124 instead of 0.

local BillboardMagnitude = {}

local plots = workspace.Plots

function BillboardMagnitude:UpdateBillboards(character)
	local HumanoidRootPart = character:FindFirstChild("HumanoidRootPart")
	if not HumanoidRootPart then return end
	
	for _, plot in pairs(plots:GetChildren()) do
		if not plot:IsA("Model") then continue end
		
		local cframe, size = plot:GetBoundingBox()
		local distance = (HumanoidRootPart.Position - cframe.Position).Magnitude
		local MAX_DISTANCE = size.X / 2
		local PlotTag = plot:FindFirstChild("PlotTag")
		if PlotTag and PlotTag:IsA("BillboardGui") then
			local frame = PlotTag:FindFirstChild("Frame")
			local alpha = math.clamp(distance / MAX_DISTANCE, 0, 1)
			print(alpha)
			frame.Size = UDim2.new(alpha, 0, alpha, 0)
		end
	end
end

return BillboardMagnitude

i’m trying to get it to start to fade when i just enter my plot - which is working but i want the transparency to be at 0 at my second square or something like this:

i appreciate any help tysm!

You can set a variable to MAX_DISTANCE - (any number) then lerp the transparency when the distance is between there and MAX_DISTANCE.

1 Like

legend. that worked perfectly, thanks a million !!