How can i skip part in a script?

So im getting an error and i want to skip this part if the player doesn’t have this in their gui, how do i do this?

local partyowner = player.PlayerGui.PlayGui.CreateFrame:WaitForChild("PartyOwner")
1 Like

Either add a time-out in the WaitForChild of a few seconds, or wrap it in a coroutine

if player.PlayerGui.PlayerGui.CreateFrame:FindFirstChild("PartyOwner") == nil then
    --SKIP
end

Might wanna check for the other parent conditions first though before verifying if PartyOwner doesn’t exist

You could use the TimeOut parameter,

local partyowner = player.PlayerGui.PlayGui.CreateFrame:WaitForChild("PartyOwner",5)

Waits 5 seconds whilst trying to get the instance and if the instance still does not exist, continue, and then have an if statement before the code that you want to use on it so if it exists, do the stuff, and if it doesn’t, don’t do anything to it