How to prevent scripts from running until game is fully loaded

You can write your topic however you want, but you need to answer these questions:

  1. I Do not want any script run until game is fully loaded.

  2. I Do not know how to do it.

  3. I Disabled all scripts in the game and Then enabled them after the game had loaded, But did not work.

2 Likes

How are you checking when the game has finished loading? How and where are you disabling the scripts?

Using this:

if not game:IsLoaded() then
	game.Loaded:Wait()
end
1 Like

You don’t really need that extra 2 lines of code. You can just use

game.Loaded:Wait()

Could you show the script where you disable and reenable the other scripts?

I Am thankful for that, However, What can we do to achieve what I want.

Here it is

local ReplactedFirst = game:GetService("ReplicatedFirst")
local Player = game.Players.LocalPlayer
local LoadingScreen = script.Parent
local TweenService = game:GetService("TweenService")

LoadingScreen.Parent = Player.PlayerGui

game.Players.LocalPlayer.CharacterAdded:Wait()

ReplactedFirst:RemoveDefaultLoadingScreen()
if Player.Name == "yous=efaaaaa097" then
else
	task.wait(1)
end

if not game:IsLoaded() then
	game.Loaded:Wait()
end

for Index, Script in game:GetDescendants() do
	if Script:IsA("LocalScript") or Script:IsA("Script") then
		Script.Disabled = false
	end
end

LoadingScreen["Background."]["Loading."]["Text changing script."].Enabled = false

local RemovingTween = TweenService:Create(LoadingScreen["Background."], TweenInfo.new(0.5, Enum.EasingStyle.Quad), {Position = LoadingScreen["Background."].Position + UDim2.new(0, 0, -1, 0)})
LoadingScreen["Background."]["Loading."].Text = "Loaded!"
wait(0.5)
RemovingTween:Play()
RemovingTween.Completed:Wait()
LoadingScreen:Destroy()

You aren’t able to change whether a script is disabled or enabled on a local script. You would need to do that on a server script.

Well, That worked, But, Is there any other way than the way I am using it?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.