Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Roblox Scripting | Adding an main menu after an loading screen. Help?

Hi! So i was trying to add an main menu after my custom loading screen was gone. I tried to do this in 2 different variants, one was to try and set the bool value to true and then in the main menu gui script add

local loadingDone = game.ReplicatedStorage.loadingScreenDone

if loadingDone.Value == true then
	script.Parent.MainFrame.Visible = true
	script.Parent.background.Visible = true
end

and when i tried to enable it manually it worked! So the script in the gui works! But when i try to enable it through the LoadingScreen Script it doesnt work! Here's my LoadingScreenManager

local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local TweenService = game:GetService("TweenService")

loadingDone = game.ReplicatedStorage:GetChildren("loadingScreenDone")


local player = Players.LocalPlayer 
local playerGui = player:WaitForChild("PlayerGui")

-- Create a basic loading screen
local screenGui = Instance.new("ScreenGui")
screenGui.IgnoreGuiInset = true
local textLabel = Instance.new("TextLabel")
textLabel.Size = UDim2.new(1, 0, 1, 0)
textLabel.BackgroundColor3 = Color3.fromRGB(0, 20, 40)
textLabel.Font = Enum.Font.GothamSemibold
textLabel.TextColor3 = Color3.new(0.8, 0.8, 0.8)
textLabel.Text = "Loading..."
textLabel.TextSize = 28
textLabel.Parent = screenGui
local loadingRing = Instance.new("ImageLabel")
loadingRing.Size = UDim2.new(0, 256, 0, 256)
loadingRing.BackgroundTransparency = 1
loadingRing.Image = "rbxassetid://4965945816"
loadingRing.AnchorPoint = Vector2.new(0.5, 0.5)
loadingRing.Position = UDim2.new(0.5, 0, 0.5, 0)
loadingRing.Parent = screenGui
-- Parent entire screen GUI to player GUI
screenGui.Parent = playerGui

-- Remove the default loading screen
ReplicatedFirst:RemoveDefaultLoadingScreen()

local tweenInfo = TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1)
local tween = TweenService:Create(loadingRing, tweenInfo, {Rotation=360})
tween:Play()

wait(6)  -- Optionally force screen to appear for a minimum number of seconds
loadingDone.Value = true
wait(1)
screenGui:Destroy()

the part where the bool value is:

loadingDone = game.ReplicatedStorage:GetChildren("loadingScreenDone")

and

loadingDone.Value = true

Also the 2 variant was to get the mainframe from the mainmenu and make it visible.

Please help!

Also dont judge me because i used the "roblox loading screen template"

2 comments

0

Are you using a local or server script?

0

local script

1 answer

✓ Accepted answer

I hope I’m correct... but your script that checks if the value is true only checks ONCE. You will need to loop this, there are many ways to do this but the most simple way is just using while true do, like this:

local loadingDone = game.ReplicatedStorage.loadingScreenDone
while true do wait()
if loadingDone.Value == true then
    script.Parent.MainFrame.Visible = true
    script.Parent.background.Visible = true
end
end

But... it’s still broken, this is because of how you created the variable “loadingDone”. GetChildren() gets ALL children, not one child, for this use :WaitForChild() like this:

loadingDone = game.ReplicatedStorage:WaitForChild(“loadingScreenDone”)

2 comments

0

Also note you may have to re write the second code because of how I wrote it.

0

Don’t forget to accept the answer if it works.

This discussion is preserved as it was. New answers, comments, and votes are closed.