Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My script isn't changing the name of this part?

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

1 comment

0

LocalScripts cannot rename parts the way you want them to. LOCALscript only make changes on the client. Since the server is checking wether or not the name changes, and the part is only renamed on the client, nothing will happen. Try changing the part's name on a regular script and see what it does.

1 answer

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

4 comments

0

So how do I fix it?

0

You're not answering his question.

0

ok i tried it and it doesnt work, iy gives me this error ReplicatedFirst.LocalScript.Loader:5: attempt to index field 'IsLoaded' (a function value)

0

BashCaster Then write a better answer

This discussion is preserved as it was. New answers, comments, and votes are closed.