I made an intro loading script and used game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
, but I can still see other GUIs while the intro is loading i don’t understand why can someone fix this?
local player = game.Players.LocalPlayer
local replicatedFirst = game:GetService("ReplicatedFirst")
local playerGui = player:WaitForChild("PlayerGui")
-- Find and clone the GUI in ReplicatedFirst
local introGui = replicatedFirst:WaitForChild("IntroGui"):Clone()
introGui.Parent = playerGui
-- Find the Frame and TextLabel
local frame = introGui:WaitForChild("Frame")
local textLabel = frame:WaitForChild("TextLabel")
local sound = introGui:WaitForChild("Sound")
-- Disable Core GUI elements
local function disableCoreGui()
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
end
-- Enable Core GUI elements
local function enableCoreGui()
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
end
-- Function to update the loading status
local function yuklemeDurumuGuncelle()
for i = 0, 239 do
textLabel.Text = "Loading Assets " .. i .. "/239"
wait(0.01) -- Simulate loading time
end
end
-- Function to simulate game loading completion
local function oyunYuklendi()
textLabel.Text = "DONE!"
wait(2) -- Display the DONE! message for 2 seconds
sound:Stop()
introGui.Enabled = false -- Disable the Intro GUI
enableCoreGui() -- Re-enable Core GUI elements
end
-- Simulate game loading
local function baslat()
disableCoreGui() -- Disable Core GUI elements
yuklemeDurumuGuncelle()
oyunYuklendi()
end
-- Check if the intro has been shown before
local function introGosterildiMi()
local key = "IntroGosterildi"
if player:GetAttribute(key) then
return true
else
player:SetAttribute(key, true)
return false
end
end
-- Start if the intro has not been shown before
if not introGosterildiMi() then
introGui.Enabled = true -- Enable the Intro GUI
sound:Play()
baslat()
else
introGui.Enabled = false -- Disable the GUI immediately if it has been shown before
end
-- Prevent the GUI from reappearing when the player respawns
player.CharacterAdded:Connect(function()
if introGosterildiMi() then
introGui.Enabled = false
end
end)