Teleport when assets loaded

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

  1. What do you want to achieve? Keep it simple and clear!

    I want to make a separate place where a player will spawn at while he hasnt fully loaded all the assets

  2. What is the issue? Include screenshots / videos if possible!

    I manage to teleport the player to the separate place but I can’t teleport him back

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

    I tried to do something with replicated storage but my scripting skills aren’t at a high enough level to figure out what went wrong with it

Below is the code:

--This is the local script that does the loading
local contentprovider = game:GetService("ContentProvider")
local ui = script:WaitForChild("Loading"):Clone()

repeat wait() until game:IsLoaded()

local assets = game:GetDescendants()
local maxassets = #assets

local plr = game.Players.LocalPlayer
local plrgui = plr:WaitForChild("PlayerGui")

ui.Parent = plrgui

for i, assetsToLoad in assets do
	ui:WaitForChild("Frame"):WaitForChild("TextLabel").Text = i.."/"..maxassets
ui:WaitForChild("Frame"):WaitForChild("TextLabel").Text = "Assets loaded"
local rs = game:GetService("ReplicatedStorage")
local loaded = rs:WaitForChild("Loaded") --Used in the server script for it to know when to teleport the player back
loaded.Value = true --false by default so player isnt teleported in the server script

--Below is the server script used for teleporting players
local rs = game:GetService("ReplicatedStorage")
local loaded = rs:WaitForChild("Loaded")
		char.HumanoidRootPart.Position =, -390.456, -430.461) --The separate place spawn
		while wait() do
			if loaded.Value == true then
				char.HumanoidRootPart.Position =, -392.421, -450.197) --Where the player needs to be teleported when he is loaded, this doesnt work

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

There’s a thing called the server-client boundary.

Almost everything you change on the client will not replicate the server, which means that your Loaded value won’t change on the server. To counter this, use a RemoteEvent.

1 Like

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