So I'm developing a camping game and I'm trying to make the players wait until everyone is loaded in until the guide starts talking
I have this localscript in replicatedfirst
wait(2) local player = game.Players.LocalPlayer repeat wait() until player.Character local character = player.Character local torso = character:WaitForChild("UpperTorso") 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. game.StarterGui.LoadedFalse.Name.Value = "LoadedTrue" if game.StarterGui.LoadedTrue then torso.Anchored = false --Unanchoring the torso, or the entire character. end
it basically makes the player not move until it changes the name of the part to LoadedTrue then I have this other script that makes the guide start to talk when the part's name is LoadedTrue
while true do script.Parent.Text = "Let's wait for everyone to load in." -- Put Text You Want wait(10) if game.StarterGui.LoadedTrue then script.Parent.Text = "h" -- Put Text You Want wait(0.5) script.Parent.Text = "hi" wait(10) script.Parent.Text = "Text Here" -- Put Text You Want wait(10) script.Parent.Text = "Text Here" -- Put Text You Want wait(10) script.Parent.Text = "Text Here" -- Put Text You Want wait(10) script.Parent.Text = "Text Here" -- Put Text You Want wait(10) end end
the problem is that the localscript in replicatedfirst never changes the name of the part resulting in me never able to move
So first if you block the UpperTorso it can kill players. Make it block the HumanoidRootPart. It will be better. Then you need only one script first. Put a local script inside the ReplicatedFirst
game.Players.PlayerAdded:Connect(function(player) local lod = script.Loader:Clone() lod.Parent = player.PlayerScripts player.Character.HumanoidRootPart.Anchored = true -- Add here the Lets Wait For Everyone To Load In text appearing end)
We use LocalScripts, because theres no way to detect if every player is loaded...
Now insert a new local script inside the prev one, name it Loader
. Write this inside:
local player = script.Parent.Parent wait(10) game.IsLoaded:Connect(function() player.Character.HumanoidRootPart.Anchored = false -- Add here the codes that you want to run when the player is able to move, like the Wait for Everyone To Load In text disappearing end)
If something isnt working, please tell me, and paste the error code, if possible