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

Check GUI if available in Inventory and Character?

Asked by 6 years ago

First of all sorry if my English bad..btw How do i check if a GUI inside StarterGui is in player inventory using 'If'..

local sp = script.Parent --- GUI inside StarterGui
local i1 = sp.intro1 --- TextLabel

if    --- What to do?

print("test")    -- Example

else

print("Test")  -- Example

end

1 answer

Log in to vote
0
Answered by
Vulkarin 581 Moderation Voter
6 years ago

If you are only checking to see if it's there at any given point of time then

if sp:FindFirstChild("ChildNameHere") then
    do something
end

If you are expecting the child soon/ want to wait for the child then

local var = sp:WaitForChild("ChildNameHere")
Ad

Answer this question