So i am making cutscene for my game, which is pretty big. With steamingenabled = true i can load fast and its all good but i cannot scope parts, even with :WaitForChild() for i get “infinite yield…” error. When i turn it off everything else works fine, but i need to wait long for game to load and its not efficient in pair with my big map. I made loadingscreen which waits for all parts to load but i still have to wait 10 more secs for terrain, and i cannot manage game like that. How to handle this problem? I’d like to be able to scope part in workspace so i can script cutscene, but i cant, and i dont know how to make it work.
:WaitForChild
should always work. The method :WaitForChild
waits for an instance to be replicated onto the client side. If an infinite yield is occurring, it could just be that you did not script it correctly.
Let me show you my script:
local x = 6;
local cam = workspace.CurrentCamera;
local player = game.Players.LocalPlayer;
local focuspart = game:GetService("Workspace"):WaitForChild("focuspart");
cam.CameraType = Enum.CameraType.Scriptable;
cam.Focus = focuspart.CFrame;
task.wait(x);
cam.CameraType = Enum.CameraType.Custom;
cam.CameraSubject = player.Character.Humanoid;
i get “infinite yield” error even tho i think everything here is written good. Also part’s name is correct. It’s put into StarterPlayerScript’s for it contains LocalPlayer, am I not wrong? For some reason i can scope models perfectly through some scripts in workspace when here i cant even scope a part.
HEY i got the problem. It occurs on where player spawns. Map i so enourmous that scripts dont work for some parts are too far away to be loaded(?) what should i do in this case? I mean, everything that is in bigger distance from spawn that what you can see doesnt work with WaitForChild() for it return infinite yield, but when i move spawn near part with which i want to use script, it seems to be working.
Edit: I had to increase StreamingTargetRadius! Thanks for all help.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.