Intro loads once player loads?

So I want to make it so my intro loads once the player is fully loaded in (kind of like the camera in the sky) then the intro loads up once your in. how do I do this.

wait(0.1)

--// Client

local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local Camera = game.Workspace.CurrentCamera

game.Lighting.Blur.Size = 15

--// GUIs

local PlayButton = script.Parent.PLAY

--// Main

Camera.CameraType = Enum.CameraType.Scriptable

repeat wait() until script.Parent.Parent == game.Players.LocalPlayer:WaitForChild("PlayerGui")

repeat wait()

Camera.CameraType = Enum.CameraType.Scriptable

until Camera.CameraType == Enum.CameraType.Scriptable

Camera.CFrame = game.Workspace:WaitForChild("CameraPart").CFrame

Heres the script that gives the intro (contains script over) to the player

function onPlayerEntered(newplayer)

wait(0.01)

local I = script.Intro:Clone()

I.Parent = newplayer.PlayerGui

local character = newplayer.Character

if not character or not character.Parent then

character = newplayer.CharacterAdded:wait()

end

end

game.Players.PlayerAdded:connect(onPlayerEntered)
3 Likes

I’ve had the same issue do this

repeat wait() until game:IsLoaded()
--or characterLoaded,but idk if thats a thing

Usally if the game is loaded,your character is loaded in!

The best way to handle an introduction screen is to not involve the server. Have the client ready everything up and run through the intro. That being said; you can handle this either through ReplicatedFirst or StarterPlayerScripts.

Get rid of the server script and make it fully local. For a ReplicatedFirst approach, put the LocalScript in ReplicatedFirst as well as the ScreenGui. After that, you can work magic from there with a few changes.


@luaVovert

This is pointless to include unless your LocalScript is in ReplicatedFirst, which is a reinvent of the wheel for the game.Loaded event. The event fires when the game “loads”.

game.Loaded:Wait()

LocalScripts outside of ReplicatedFirst only fire after game.Loaded does, which means you’re introducing an unnecessary loop in your code.

You should also not be relying on game.Loaded for character spawns either. The game being loaded doesn’t mean that characters are.