local get_ui = plr:WaitForChild('PlayerGui')
local get_framework = get_ui:FindFirstChild('UIFramework')
local level_frame = get_framework['level_frame']
-- Error:
15:58:32.393 ReplicatedStorage.GameModules.game_functions:144: attempt to index nil with 'level_frame' - Server - game_functions:144
This error only happens sometimes; if I join and click play to test in studio sometimes it won’t give this error and everything loads correctly, while other times I get this error and it stops my script from running.
There is proof that it exists, and is in the correct place.
This error is inconsitent, how so??
when your game gets bigger with more assets added, it’ll begin to be noticable as it’s loading the content in the background, your UI might’ve been in process of being loaded before it returns as the instance you’re lookin for.
and as a result, your localscript runs and it still sees nil
a common fix that i use for my game is to make a custom StarterGUI and store all the screen gui in the ReplicatedStorage, it’s the only container that i believe will be replicated to the client first.