I usually never play with GUI tweening… So I saw your post and replies and I wanted to give it a try.
@rvaee and @BonesIsUseless already explained all the basics you need to use the TweenService, but forgot to mention that you should create one Tween per ImageLabel per Button per TextLabel etc that is inside your Frame, otherwise only the main Frame will tween and the rest of components inside of it wont…
But, manually create a tween per component and play them all hardcoded is not efficient and will result in a timeConsuming long script. Plus, depending on the component you would wish to tween the ImageTransparency property or the TextTransparency or the BackgroundTransparency property, and if you try to tween a property that a gui component doesnt have that will cause an error.
So I made this script that does that stuff, checking the properties of each component, creating a tween per component with the right properties to tween, excluding the ones that are transparency = 1
from the original gui setup, and play all tweens at the same time to fadeIn and out, heres a video:
(I like that apple, thats another reason why I wanted to provide some help, and I kinda recreated your splash screen)
The script:
local TS = game:GetService("TweenService")
-- LoadingFruit Frame
local LoadingFruitGUI = script.Parent:WaitForChild("LoadingFruit") -- Your Frame
-- Button
local Button = script.Parent:WaitForChild("ImageButton") -- A button I created to test it
-- Tween config
local Info = TweenInfo.new(2) -- This is 2 seconds, add the other values to customize the Tween behaviour
-- Function to check if an instance has a specific property
function hasProperty(obj, prop)
local success, _ = pcall(function()
obj[prop] = obj[prop]
end)
if success and obj[prop] ~= 1 then -- If its not originally transparent
-- Optionally set all Transparencies to starting point 1 to hide them
obj[prop] = 1
return success
else
return false
end
end
-- Properties to be checked in each Gui component
local PossibleProperties = {"ImageTransparency", "BackgroundTransparency", "TextTransparency"}
local TweenTable_FadeIN = {} -- Table holding all Tweens FadeIn
local TweenTable_FadeOUT = {} -- Table holding all Tweens FadeOut
-- Function to create Tweens
local function CreateTweens(obj)
local FadeIN = {}
local FadeOut = {}
for _, prop in pairs(PossibleProperties) do
if hasProperty(obj, prop) then
FadeIN[prop] = 0
FadeOut[prop] = 1
end
end
table.insert(TweenTable_FadeIN, TS:Create(obj, Info, FadeIN))
table.insert(TweenTable_FadeOUT, TS:Create(obj, Info, FadeOut))
end
-- Create multiple Tweens one per GUI component
for _, obj in pairs(LoadingFruitGUI:GetDescendants()) do
CreateTweens(obj)
end
CreateTweens(LoadingFruitGUI) -- Create tween for one Frame
local btnDebounce = false
Button.Activated:Connect(function()
if not btnDebounce then
LoadingFruitGUI.Visible = true
local tweenDebounce = false
btnDebounce = true
for _, tween in pairs(TweenTable_FadeIN) do
if not tweenDebounce then
tweenDebounce = tween
end
tween:Play()
end
tweenDebounce.Completed:Wait()
-- The TP
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(100,5,100)
task.wait(1) -- Extra wait time for splash window
tweenDebounce = false
for _, tween in pairs(TweenTable_FadeOUT) do
if not tweenDebounce then
tweenDebounce = tween
end
tween:Play()
end
tweenDebounce.Completed:Wait()
LoadingFruitGUI.Visible = false
btnDebounce = false
end
end)
Just change the lines referencing the LoadingFruit frame and button, tell me if you have issues to make it work. 