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?
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
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.
even tho i added that
it still print that
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.
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