You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I wan’t to achieve a loading screen with random tips.
What is the issue? Include screenshots / videos if possible!
While the loading bar itself works, the tips don’t appear.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried to move the Tips script (which is grouped with the loading screen script) to another one.
local replicatedFirst = game:GetService("ReplicatedFirst")
local contentProvider = game:GetService("ContentProvider")
local tweenService = game:GetService("TweenService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local loadingScreen = script:WaitForChild("LoadingScreen")
replicatedFirst:RemoveDefaultLoadingScreen()
repeat task.wait() until game:IsLoaded()
local assets = game:GetDescendants()
local clonedLoadingScreen = loadingScreen:Clone()
clonedLoadingScreen.Parent = playerGui
for i = 1, #assets do
local asset = assets[i]
local percentage = math.round(i / #assets * 100)
contentProvider:PreloadAsync({asset})
clonedLoadingScreen.BackRound.DisplayPercentege.Text = percentage.."%"
clonedLoadingScreen.BackRound.DissplayAssetsLoaded.Text = "Loading Assets: "..i.."/"..#assets
tweenService:Create(clonedLoadingScreen.BackRound.BarBackround.Bar, TweenInfo.new(0.2,Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {Size = UDim2.fromScale(percentage/100, 1)}):Play()
if i == #assets then
task.wait(1)
end
if not game:IsLoaded() then
repeat
local tips = {"If the lights flicker in a room, hide in a vent or freezing pod.", "If a crate has green glow, open it! It contains something special.", "Always co-operate with your teammates if you have any."}
local tweentip1 = tweenService:Create(clonedLoadingScreen.BackRound.Tips, TweenInfo.new(0.25), {TextTransparency = 1})
local tweentip2 = tweenService:Create(clonedLoadingScreen.BackRound.Tips, TweenInfo.new(0.25), {TextTransparency = 0})
local tweentip3 = tweenService:Create(clonedLoadingScreen.BackRound.Tips, TweenInfo.new(0.25), {TextStrokeTransparency = 1})
local tweentip4 = tweenService:Create(clonedLoadingScreen.BackRound.Tips, TweenInfo.new(0.25), {TextStrokeTransparency = 0})
clonedLoadingScreen.BackRound.Tips.Text = "Tip : ".. tips[math.random(1,#tips)]
wait(4)
tweentip1:Play()
tweentip3:Play()
wait(0.25)
tweentip2:Play()
tweentip4:Play()
clonedLoadingScreen.BackRound.Tips.Text = "Tip : ".. tips[math.random(1,#tips)]
until game:IsLoaded() == true
end
end
for i, v in pairs(clonedLoadingScreen:GetDescendants()) do
if v:IsA("Frame") then
tweenService:Create(v, TweenInfo.new(0.5), {BackgroundTransparency = 1}):Play()
elseif v:IsA("TextLabel") then
tweenService:Create(v, TweenInfo.new(0.5), {TextTransparency = 1}):Play()
end
end
Did you make sure that the TextTransparency was changing as expected in the explorer tab? It could be because .Visible is set to false instead of TextTransparency being set to 1 initially.
This is a good point, we can also fix some minor things in the tips loop:
local tips = {"If the lights flicker in a room, hide in a vent or freezing pod.", "If a crate has green glow, open it! It contains something special.", "Always co-operate with your teammates if you have any."}
local tipsToSelect = {table.unpack(tips)}
local tweenVisible = tweenService:Create(clonedLoadingScreen.BackRound.Tips, TweenInfo.new(0.25), {TextTransparency = 0, TextStrokeTransparency = 0})
local tweenInvisible = tweenService:Create(clonedLoadingScreen.BackRound.Tips, TweenInfo.new(0.25), {TextTransparency = 1, TextStrokeTransparency = 1})
if not game:IsLoaded() then
repeat
local selectedNum = math.random(1,# tipsToSelect)
local selected = tipsToSelect[selectedNum]
table.remove(tipsToSelect, selectedNum)
clonedLoadingScreen.BackRound.Tips.Text = "Tip : ".. selected
task.wait(0.25)
tweenVisible:Play()
task.wait(4)
tweenInvisible:Play()
until game:IsLoaded() == true
end
Nope, no errors in the output and i did put it in a new script.
Here’s the new script :
local TweenService = game:GetService("TweenService")
local clonedLoadingScreen = game:GetService("Players").LocalPlayer.PlayerGui:WaitForChild("LoadingScreen")
if not game:IsLoaded() then
repeat
local tips = {"If the lights flicker in a room, hide in a vent or freezing pod.", "If a crate has green glow, open it! It contains something special.", "Always co-operate with your teammates if you have any."}
local tweentip1 = TweenService:Create(clonedLoadingScreen.BackRound.Tips, TweenInfo.new(0.25), {TextTransparency = 1})
local tweentip2 = TweenService:Create(clonedLoadingScreen.BackRound.Tips, TweenInfo.new(0.25), {TextTransparency = 0})
local tweentip3 = TweenService:Create(clonedLoadingScreen.BackRound.Tips, TweenInfo.new(0.25), {TextStrokeTransparency = 1})
local tweentip4 = TweenService:Create(clonedLoadingScreen.BackRound.Tips, TweenInfo.new(0.25), {TextStrokeTransparency = 0})
clonedLoadingScreen.BackRound.Tips.Text = "Tip : ".. tips[math.random(1,#tips)]
wait(4)
tweentip1:Play()
tweentip3:Play()
wait(0.25)
tweentip2:Play()
tweentip4:Play()
until game:IsLoaded() == true
end