Teleport to the main place without showing loading screen

I have a game with two places.
One is the spawn and other is the game area.
I have added a loading screen to the main place. so that when people enter the game the loading screen will be shown.

To play i teleport the players to the ‘game area place’.
While coming back, it shows the loading screen of the spawn area, which I dont want to show because the player is already in the game.

I have placed the loading screen in ReplicatedFirst and i dont have any idea how to tell the loading screen to not show when the player is coming back from ‘game area’??

Is there any way to achieve this??

Here is my loading screen script kept in ReplicatedFirst

-- Imports
game.ReplicatedFirst:RemoveDefaultLoadingScreen()

local TweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local PlayerModule = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"))
local StarterPlayer = game:GetService("StarterPlayer")
local PlayerGUI = player.PlayerGui
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local ingamegui = PlayerGUI:WaitForChild("ScreenGui")

-- Getting required things
local Controls = PlayerModule:GetControls()
Controls:Disable()
StarterPlayer.CharacterJumpPower = 0
ingamegui.Enabled = false


-- The loading screen GUI
local GUI = script.ScreenGui:Clone()
GUI.Parent = PlayerGUI

task.wait(3.5)
GUI.by.Visible = false
GUI.Frame.Visible = true

task.wait(4)

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

TweenService:Create(GUI.Frame, 
	TweenInfo.new(0.5,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.Out
	),
	{Position=UDim2.new(0,0,1,0)}
):Play()
wait(1)

GUI:Destroy()
Controls:Enable()
StarterPlayer.CharacterJumpPower = 50
ingamegui.Enabled = true

You should move this to Scripting Support - DevForum | Roblox because you will want to have your loading screen load in only when there is a PlayerAdded event… post your loading screen script in there and you will get some good solutions.

I have added the script, and it is a local script in ReplicatedFirst

Ok im not too strong in scripting but I will point you in the right direction… I believe you will need to set up teleport data, a bool, that will be true if the player is coming from that other place… then retrieved when the player enters the lobby again. You will then add to your script above a line to retrieve the data of the player using TeleportService:GetLocalPlayerTeleportData, that bool value, and play the loading screen depending on if that bool value is true.

You can read more about it here:

https://developer.roblox.com/en-us/api-reference/function/TeleportService/Teleport

2 Likes