So i have a customize character button and it has a transparency tween so it fades and the button to go back to the menu also has a transparency tween.
but when i press back while the tween is playing my screen becomes black
So i have a customize character button and it has a transparency tween so it fades and the button to go back to the menu also has a transparency tween.
but when i press back while the tween is playing my screen becomes black
a quick solution would be to implement a debounce that is used for all buttons that cause that transition so until the tween ends, debounce prevents buttons code from being initiated.
perhaps make the transition quicker as well?
I would also like to see your code of the tween cause tweenservice usually doesn’t glitch like this
this is the main menu script
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local PlayerGui = player:WaitForChild("PlayerGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local cam = workspace.CurrentCamera
repeat wait() until cam.CameraSubject ~= nil
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = workspace.MainMenu.CFrame
local staminabar = script.Parent.Parent.Stamina.Border
staminabar.Visible = false
local inviteBtn2 = PlayerGui.Invite2:Clone()
local inviteBtn3 = PlayerGui.Invite3:Clone()
local inviteBtn4 = PlayerGui.Invite4:Clone()
local lobbyspawn2 = workspace.LobbySpawns.Plr2Spawn
inviteBtn2.Enabled = false
inviteBtn3.Enabled = false
inviteBtn4.Enabled = false
local FadeFrame = PlayerGui.Customization:WaitForChild("FadeFrame")
local tweenService = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, true, 0)
local tween1 = tweenService:Create(FadeFrame, tweeninfo, {BackgroundTransparency = 0})
local sound = Instance.new("Sound", game.Workspace)
local tweeninfo2 = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local soundtween = tweenService:Create(sound, tweeninfo, {Volume = 0})
local tweeninfo3 = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local tween2 = tweenService:Create(script.Parent.Play, tweeninfo3, {BackgroundTransparency = 0.3})
local tweeninfo4 = TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local tween3 = tweenService:Create(script.Parent.Play, tweeninfo3, {BackgroundTransparency = 1})
local tween4 = tweenService:Create(script.Parent.CharCreate, tweeninfo3, {BackgroundTransparency = 0.3})
local tween5 = tweenService:Create(script.Parent.CharCreate, tweeninfo3, {BackgroundTransparency = 1})
local tween6 = tweenService:Create(script.Parent.Multiplayer, tweeninfo3, {BackgroundTransparency = 0.3})
local tween7 = tweenService:Create(script.Parent.Multiplayer, tweeninfo3, {BackgroundTransparency = 1})
sound.SoundId = "rbxassetid://6573177583"
sound.Volume = 0.2
task.wait()
sound:Play()
script.Parent.Play.MouseEnter:Connect(function()
tween2:Play()
script.Parent.Play.TextColor3 = Color3.new(1, 1, 1)
end)
script.Parent.Play.MouseLeave:Connect(function()
tween3:Play()
script.Parent.Play.TextColor3 = Color3.new(0.490196, 0.490196, 0.490196)
end)
script.Parent.CharCreate.MouseEnter:Connect(function()
tween4:Play()
script.Parent.CharCreate.TextColor3 = Color3.new(1, 1, 1)
end)
script.Parent.CharCreate.MouseLeave:Connect(function()
tween5:Play()
script.Parent.CharCreate.TextColor3 = Color3.new(0.490196, 0.490196, 0.490196)
end)
script.Parent.Multiplayer.MouseEnter:Connect(function()
tween6:Play()
script.Parent.Multiplayer.TextColor3 = Color3.new(1, 1, 1)
end)
script.Parent.Multiplayer.MouseLeave:Connect(function()
tween7:Play()
script.Parent.Multiplayer.TextColor3 = Color3.new(0.490196, 0.490196, 0.490196)
end)
script.Parent.CharCreate.MouseButton1Click:Connect(function()
tween1:Play()
soundtween:Play()
task.wait(2)
cam.CFrame = workspace.CameraLocation.CFrame
script.Parent.CharCreate.Visible = false
script.Parent.Play.Visible = false
script.Parent.Multiplayer.Visible = false
script.Parent.Parent.Customization.Back.Visible = true
script.Parent.Parent.Customization.Hair.Visible = true
script.Parent.Parent.Customization.Shirt.Visible = true
script.Parent.Parent.Customization.Pants.Visible = true
sound:Stop()
end)
script.Parent.Play.MouseButton1Click:Connect(function()
tween1:Play()
soundtween:Play()
task.wait(2)
cam.CameraType = Enum.CameraType.Custom
script.Parent.Play.Visible = false
script.Parent.CharCreate.Visible = false
script.Parent.Multiplayer.Visible = false
staminabar.Visible = true
sound:Stop()
end)
script.Parent.Multiplayer.MouseButton1Click:Connect(function()
tween1:Play()
soundtween:Play()
task.wait(2)
inviteBtn2.Enabled = true
inviteBtn3.Enabled = true
inviteBtn4.Enabled = true
cam.CFrame = workspace.LobbySpawn.CFrame
script.Parent.CharCreate.Visible = false
script.Parent.Play.Visible = false
script.Parent.Multiplayer.Visible = false
sound:Stop()
end)
this is the character customization script
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local PlayerGui = player:WaitForChild("PlayerGui")
local cam = workspace.CurrentCamera
local FadeFrame = PlayerGui.Customization:WaitForChild("FadeFrame")
local tweenService = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, true, 0)
local tween1 = tweenService:Create(FadeFrame, tweeninfo, {BackgroundTransparency = 0})
script.Parent.Back.MouseButton1Click:Connect(function()
game.ReplicatedStorage.Customization.UpdateClothing:FireServer(dummy.Shirt.ShirtTemplate,dummy.Pants.PantsTemplate)
tween1:Play()
task.wait(2)
cam.CFrame = workspace.MainMenu.CFrame
script.Parent.Hair.Visible = false
script.Parent.Pants.Visible = false
script.Parent.Shirt.Visible = false
script.Parent.Back.Visible = false
script.Parent.Parent.MainMenu.CharCreate.Visible = true
script.Parent.Parent.MainMenu.Play.Visible = true
script.Parent.Parent.MainMenu.Multiplayer.Visible = true
end)
can you show where the tween that makes the fadeframe transparent? I only see the tween1 where it plays on mouseclick (to darken fadeframe) then nothing else?
wait i see it
you have it set to where it reverses
I believe if you simply make a seperate tween and make the reverse bool false for both, your solution will be clear and I will elaborate in a moment
convert to:
local tweeninfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
--[[
put true to false to remove reverse, it reversed back to whatever value
the fadegui element was at which is why you saw that it was black
when you click a button while tween in progress
]]
local tween1 = tweenService:Create(FadeFrame, tweeninfo, {BackgroundTransparency = 0})--visible
local tween12 = tweenService:Create(FadeFrame, tweeninfo, {BackgroundTransparency = 1})--invisible
you may also utilize Tween.Ended:Wait() , sample:
tween1:Play() -- plays tween visible black
tween1.Ended:Wait() --waits until tween completely done
tween12:Play() -- plays invisible tween black
Thank you for your help, it works perfectly now