#Frame not being found in script while placement in Explorer is fine. Unsure of what the error is.

1 messages · Page 1 of 1 (latest)

hollow pumice
#

This sounds really confusing and long but hear me out. I don't know how to fix this and it's literally been such a pain that i'm not sure if its a bug with a script or with studio itself. In a script that fades the screen to black then normal again using a black screen GUI (Activated with a Proximity Prompt), I'm trying to identify the frame in the local player's Gui. Easy, right? NAH. That's the entire issue. When running the game, you can indeed find the ScreenGui in the PlayerGui, but the script keeps giving outputs for "Frame is not a valid member of "BlackScreen" or "Infinite Yield possible on 'BlackScreen:WaitForChild("Frame")
I'm running out of options because there aren't any reasons that I can think of as to why this won't work. I'm still somewhat new to scripting, so if I missed anything, or I did something wrong that could be causing this issue, please let me know.

abstract basin
frozen oracle
meager ferry
#

i don't think that's true, it checks for the instance existing and if it doesn't find it it waits for the period of time specified by argument 2

#

try removing the type check

hollow pumice
#

"Frame is not a valid member of BlackScreen"

#

that's why I added the wait for child and it still doesn't work bc the system isn't identifying the frame

hollow pumice
hollow pumice
#

you know what I deadass might actually have to script an Instance.new() to make a new frame I didn't even think of that until like just now

#

that could actually work

frozen oracle
hollow pumice
#

a week or two

frozen oracle
#

But yeah using "Wait for Child" is good when you know its not there yet, but is on its way. And if you do WaitForChild on a model, then you dont need to do it on the model's children. Cause it loads in the children before the model group itself
you just automatically avoid this issue with module scripts due to the parent script having to boot up first, and then run the modulescript, giving time for the other stuff to load in

#

But yeah if it says "infiniteYield" possible, it means the child "Frame" already existed when you did WaitForChild

frozen oracle
hollow pumice
#

Something along the lines of "tried finding material for Frame, got nil"

#

or something like that idk

frozen oracle
hollow pumice
#

but before, I merged the frame and transparency lines so it was blkscreen.Frame.Transparency

#

or blkscreen:FindFirstChild("Frame").Transparency

frozen oracle
#

Ill just make a gui and test it myself

#

this worked for me
guiScript

local guiSystem = {}

local players = game:GetService("Players")
local lp = players.LocalPlayer
local gui = lp.PlayerGui
local blackScreen = gui:FindFirstChild("BlackScreen")
local frame = blackScreen:FindFirstChild("Frame")

function guiSystem.begin()
    for i=1,10 do
        frame.Transparency+=-0.1
        task.wait(1)
    end
end
return guiSystem
#

Video of it working. So it seems like its working fine on my end
perhaps would be very helpful to then know the name of your script, and where it is located, and where it is used if its a modulescript

meager ferry
#

see also

name. If the child does not exist, it will yield the current thread until it does. If the timeOut parameter is specified, this method will time out after the specified number of seconds and return nil.

meager ferry
frozen oracle
#

anyways somehow works for me

hollow pumice
#

i can't be any more honest

#

i'm completely lost

#

as you can see i made an Instance.New()

#

and the black screen in question isnt even appearing

#

the weirdest part is that there are literally 0 errors

#

is it because it's a localscript and not a script that the instance wont get added to the local players playergui

frozen oracle
# hollow pumice

You should add print statements so its easier to debug. E.g. put one at the start of Triggered function like
print("Proximity Triggered")

then later some info like
if frame then
print("Frame exists")
end

#

Im trying my best to replicate it, but for me the gui script just works so i think it might be the prox

frozen oracle