# Operator Doesn't Work Correctly

Try creating a new place and placing the folder with the script and checkpoints and see if it returns the true length

i also added delay but that also doesnt work

Also this ā€œ10ā€ is coming from this specific checkpoint script and not another one right? Additionally I’m assuming the checkpoints folder is located in workspace?


thats my explorer

yeah its located in the workspace and the 10 comes from the same script

OH WAIT i use the # method in the client for my progress bar and my skip stage button

image

and was that where the 10 was coming from or was it coming from the server script?

from the client. But what difference does it make anyways?

The instances arent replicated to the client immediately so the client only believes 10 objects exist instead of all of them.

You can make the CheckpointAmount accurate by changing it to
local CheckpointAmount = #Checkpoints:GetChildren()
Checkpoints.ChildAdded:Connect(function()
CheckpointAmount+=1
end)

so what do i need to do to fix that issue

Then that is your issue. On the client, not everything is loaded in the workspace. Use this pattern instead:

local function onCheckpointAdded(checkpoint: Instance): ()
    if checkpoint:IsA("BasePart") then
        -- update # checkpoints
    end
end

Checkpoints.ChildAdded:Connect(onCheckpointAdded)

for _, child: Instance in Checkpoints:GetChildren() do
    task.spawn(onCheckpointAdded, child)
end

Edit: If you want to just get the guaranteed amount of checkpoints without needing to load all the checkpoints, you can add an attribute to the Folder on the server.

1 Like

even tho i added that
image
it still print that
image

This is the client script? The other children may already be detected by the client

You can see which checkpoints are replicated to the client by clicking the play button and going to explorer and the checkpoints folder.

image
oh dam

Do you have streaming enabled on? If so, parts far away wont load until you get close to them and the client wont know they exist.

yeah its enabled in thw workspace

No, keep your original code. There is no need to do that on the server. Refer to this post edit for the solution: # Operator Doesn't Work Correctly - #32 by OniiSamaUwU

Either turn it off or you can just add the touched event under the Child added function