Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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

0
nvm I got it. Thanks me! hacker14141 -5 — 5y
0
...congratulations? DaBrainlessOne 129 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

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

Answer this question