The output says: attempt to index global 'gui' a nil value.
Is there a way to stop this from happening or is there another way to get PlayerGui?
If I put the variables inside then the frame shows up but then it errors for the textbox saying attempt to index global 'h' a nil value for later lines.
game.Players.PlayerAdded:connect(function(p)
gui = p:WaitForChild("PlayerGui")
end)
h = gui:WaitForChild("WOAH"):FindFirstChild("TextBox")
f = gui:WaitForChild("WOAH"):FindFirstChild("Frame")
I'm sure that they are all in playergui so is there anyway to fix this?

1 comment
In the very first line of the script, type "gui = nil" and tadaa! Problem is gone.