Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is it possible to check if something is a valid member of another thing?

I'm trying to detect if a screenGui is a valid member of the player gui because I'm cloning it into the player with a 'E' to interact code I've made but I must be able to check if there is already a screenGui in the player and if there isn't then it will clone it in other wise it won't do anything. Somebody please help me.

2 answers

if game.Players.LocalPlayer.PlayerGui:FindFirstChild("ScreenGui") ~= nil then

This should be what you're looking for. Just change it to fit how you're coding it

2 comments

0

nvm I got it. Thanks me!

0

...congratulations?

Use This if you want to check if it exists:

if Where its need to be valid:FindFirstChild("Whats Needs to be valid") then
What Is going to happen if its valid

end Or This If you Want to know if its doesn't exist:

if not Where its need to be valid:FindFirstChild("Whats Needs to be valid") then
What Is going to happen if its valid

end

I Hope this is what u want

This discussion is preserved as it was. New answers, comments, and votes are closed.