Frame tween not working

What object is script.Parent.Back?

I think its a button that closes a frame with a tween animation

Just to make sure whether its a button object

try Activated for the button event, but honestly everything else looks fine to me. try putting prints in the event to see where it doesn’t work or do script.Parent:WaitForChild(“Back”)

local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
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()
end

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

its a TextButton to finish your character creation

@fun_tijger

There is still no tween happening

can u try adding print to see where it gets stuck at

i added two prints and they both worked

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("tweenfunction")
end

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

what type of script are u using?

Where’s the camera at? That may be your problem, you could also set it to Enum.CameraType.Scriptable then to Enum.CameraType.Custom

im using a localscript (3O charrrrr)

It was already set to scriptable because the script is for character customization and then after the tween the cameratype is set to custom.

I think I know. Try setting this 0 in tween(fadeframe) to 1

I can’t really tell what’s wrong with the script if I can’t see the variables.

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.