Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

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. RegisteredCode 5 — 4y

1 answer

Log in to vote
0
Answered by
WoTrox 345 Moderation Voter
4 years ago
Edited 4 years ago

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

0
So how do I fix it? VincentestleRoi -14 — 4y
0
You're not answering his question. DeceptiveCaster 3761 — 4y
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) VincentestleRoi -14 — 4y
0
BashCaster Then write a better answer WoTrox 345 — 4y
Ad

Answer this question