#How do I wait for descandents on the Client?
1 messages · Page 1 of 1 (latest)
yea
so I tried this actually
if not game:IsLoaded() then
game.Loaded:Wait()
end
but it doesnt seem to really work
could it not work cause im testing in studio?
repeat task.wait()
until game:IsLoaded()
repeat task.wait()
until game:IsLoaded()
local worlds = game.Workspace:WaitForChild("worlds"):GetChildren()
local clientObj = {}
for _, world in ipairs(worlds) do
local trailsFolder = world:WaitForChild("trails")
local trails = trailsFolder:GetChildren()
for _, trail in ipairs(trails) do
local obbyFolder = trail:WaitForChild("obby")
local obbyParts = obbyFolder:GetChildren()
for _, obbyPart in ipairs(obbyParts) do
if obbyPart:FindFirstChild("ClientObject") then
table.insert(clientObj, obbyPart)
end
end
end
end
print(clientObj)
the array still is empty
why not use GetDescendants and find out if the object is a clientobject?
I tought that would be too performance taking
there is
imagine theres like 1000 parts in assets and i gotta loop through all that
its unnecessary
thats why im skipping the unneeded folders
why not?
cause you can like only get the items from collectionservice wehn they are in your render distance
hmm
idk the jtoh clientobject framework also loops through the whole workspace but i dont understand how it works for them that everything is loaded 😭
o yea
is tehre even an object named ClientObject??
looking into this since theres no object named clientobject
ClientObject is the bool value
oh the bool
maybe ima send a signal from the server wehn someone enters a trail and then im gonna run that
that would also be less performance taking
i mean sure
ig thats the best way to do it then i can also decide which obbies to load wehn and make it work on low end devices