So I have the character anchored when he joins, and they're meant to stay there until everything has loaded. How do I check to make sure everything's been loaded before letting the player play?
There is a way to do this actually. A DataModel (i.e. Service) called ReplicatedFirst
runs before everything is loaded.
Another DataModel called ContentProvider
has the property RequestQueueSize
.
When RequestQueueSize
hits 0, that means everything in the game has loaded (Decals, Parts, etc.).
Since scripts are run only Locally in ReplicatedFirst, it will run only on the client, so it won't worry about any other computers running on the game.
Check this out:
LocalScript directly inside ReplicatedFirst:
local player = game.Players.LocalPlayer repeat wait() until player.Character local character = player.Character local torso = character:WaitForChild("Torso") torso.Anchored = true --Anchoring the torso, or the entire character. repeat wait() until game.ContentProvider.RequestQueueSize > 0 --This line will make it wait until everything is loaded. torso.Anchored = false --Unanchoring the torso, or the entire character.
Be a little more specific, tell us what you want loaded.
Currently there isen't a way to find this. Using wait in this case will just make it after a period of time. However many computers are different from yours. I suggest just not doing this.