Frame tween not working

It needs to be 0 because the transparency needs to go from 1 to 0

here’s my whole script:

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local PlayerGui = player:WaitForChild("PlayerGui")

cam = workspace.CurrentCamera

repeat wait() until cam.CameraSubject ~= nil

cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = workspace.CameraLocation.CFrame

if not char:FindFirstChild("Shirt") then
	local shirt = Instance.new("Shirt", char)
	shirt.Name = "Shirt"
end
if not char:FindFirstChild("Pants") then
	local pants = Instance.new("Pants", char)
	pants.Name = "Pants"
end


char.Archivable = true
local dummy = char:Clone()
dummy.Parent = workspace

dummy:MoveTo(workspace.CSpawn.Position)


--shirts

local allShirts = game.ReplicatedStorage:WaitForChild("Customization"):WaitForChild("Shirts"):GetChildren()

dummy:WaitForChild("Shirt").ShirtTemplate = allShirts[1].ShirtTemplate
script.Parent.Shirt.Current.Value = 1

script.Parent.Shirt.Next.MouseButton1Click:Connect(function()
	script.Parent.Shirt.Current.Value = script.Parent.Shirt.Current.Value + 1
	if script.Parent.Shirt.Current.Value > #allShirts then 
		script.Parent.Shirt.Current.Value = 1
	end
	
	dummy:WaitForChild("Shirt").ShirtTemplate = allShirts[script.Parent.Shirt.Current.Value].ShirtTemplate
end)

script.Parent.Shirt.Previous.MouseButton1Click:Connect(function()
	script.Parent.Shirt.Current.Value = script.Parent.Shirt.Current.Value - 1
	if script.Parent.Shirt.Current.Value < 1 then 
		script.Parent.Shirt.Current.Value = #allShirts
	end

	dummy:WaitForChild("Shirt").ShirtTemplate = allShirts[script.Parent.Shirt.Current.Value].ShirtTemplate
end)
--pants

local allPants = game.ReplicatedStorage:WaitForChild("Customization"):WaitForChild("Pants"):GetChildren()

dummy:WaitForChild("Pants").PantsTemplate = allPants[1].PantsTemplate
script.Parent.Pants.Current.Value = 1

script.Parent.Pants.Next.MouseButton1Click:Connect(function()
	script.Parent.Pants.Current.Value = script.Parent.Pants.Current.Value + 1
	if script.Parent.Pants.Current.Value > #allPants then 
		script.Parent.Pants.Current.Value = 1
	end

	dummy:WaitForChild("Pants").PantsTemplate = allPants[script.Parent.Pants.Current.Value].PantsTemplate
end)

script.Parent.Pants.Previous.MouseButton1Click:Connect(function()
	script.Parent.Pants.Current.Value = script.Parent.Pants.Current.Value - 1
	if script.Parent.Pants.Current.Value < 1 then 
		script.Parent.Pants.Current.Value = #allPants
	end

	dummy:WaitForChild("Pants").PantsTemplate = allPants[script.Parent.Pants.Current.Value].PantsTemplate
end)

--Finished
local function tween(obj,value)
	local tweenService = game:GetService("TweenService")
	local tweeninfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, true, 0)
	local tween1 = tweenService:Create(obj, tweeninfo, {BackgroundTransparency = value})
	tween1:Play()
	print("tween1")
end

script.Parent.Back.MouseButton1Click:Connect(function()
	local FadeFrame = PlayerGui.Customization:WaitForChild("FadeFrame")
	wait(0.1)
	print("tween2")
	tween(FadeFrame,0)
	game.ReplicatedStorage.Customization.UpdateClothing:FireServer(dummy.Shirt.ShirtTemplate,dummy.Pants.PantsTemplate)
	script.Parent.Enabled = false
	cam.CameraType = Enum.CameraType.Custom
end)




I fixed it by adding

wait()

before my script.Parent.Enabled = false

Use task.wait() instead of wait(), it’s just better, and I don’t want to explain why exactly, it’s just task.wait() (with no parameters) is the same as RunService.Heartbeat:Wait(), unlike wait() which is a 1/30 of a second. task.wait() also has better performance than wait(). You can read more about it here.