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

GUI Not Showing?

Asked by 10 years ago

So i recently took some help from others to create a "url bar" in my computer, here's the code.

--- Configuration ---
plr = game.Players.LocalPlayer
comp = plr.PlayerGui.NNet
notice = comp.Notice

-- Domains --
youtube = comp.Websites.YouTube
roblox = comp.Websites.Roblox
twitter = comp.Websites.Twitter

-- Code --
comp.MainFrame.UrlBar.FocusLost:connect(function()
    input = comp.MainFrame.UrlBar.Text
if input == "youtube.rbx" or input == "www.youtube.rbx" or input == "http://youtube.rbx" then
    youtube.Visible = true
    notice.Visible = true
    notice:TweenPosition(UDim2.new(0, 100,0, 300), "Out", "Quad")
    wait(4)
    notice:TweenPosition(UDim2.new(0, 0,0, 0), "Out", "Quad")
    wait(2)
    notice.Visible = false
elseif input == "roblox.rbx" or input == "www.roblox.rbx" or input == "http://roblox.rbx" then
    roblox.Visible = true
    notice.Visible = true
    notice:TweenPosition(UDim2.new(0, 100,0, 300), "Out", "Quad")
    wait(4)
    notice:TweenPosition(UDim2.new(0, 0,0, 0), "Out", "Quad")
    wait(2)
    notice.Visible = false
elseif input == "twitter.rbx" or input == "www.twitter.rbx" or input == "http://twitter.rbx" then
    twitter.Visible = true
    notice.Visible = true
    notice:TweenPosition(UDim2.new(0, 100,0, 300), "Out", "Quad")
    wait(2)
    notice:TweenPosition(UDim2.new(0, 0,0, 0), "Out", "Quad")
    wait(2)
    notice.Visible = false
else
    comp.MainFrame.UrlBar.Visible = false
    comp.MainFrame.UrlError.Visible = true
    comp.Websites.YouTube.Visible = false
    comp.MainFrame.UrlError.Text = "ERROR: Url Not Found!"
    wait(4)
    comp.MainFrame.UrlError.Visible = false
    comp.MainFrame.UrlBar.Visible = true
    end
end)

Here's my problem,

The script works in Solo Mode but wont work in a server (clicking play out of studio), so i am trying to figure out why that is... There are no errors, i've tried if statements for all of them, it works either way.

So if you could please help me with trying to figure out why my gui doesn't work in an actual server

=============

New Errors (5/17/2014)

13:50:54.356 - Notice is not a valid member of ScreenGui
13:50:54.357 - Script 'Players.Player1.PlayerGui.NNet.MainFrame.UrlBar.DomainCheck', Line 4
13:50:54.357 - Stack End

BUT! Notice is a valid member.

Screenshot: puu.sh/8Q9iW.png

1 answer

Log in to vote
0
Answered by
hiccup111 231 Moderation Voter
10 years ago

I setup a quick gui, of what was in the gui-picture you uploaded.

Classic case of ROBLOX being too slow to load guis, or.. rather Local Scripts running before the Guis have loaded.

Here you go.

--- Configuration ---
plr = game.Players.LocalPlayer
comp = plr.PlayerGui.NNet
repeat wait() until comp:FindFirstChild("Notice")
notice = comp.Notice

-- Domains --
youtube = comp.Websites.YouTube
roblox = comp.Websites.Roblox
twitter = comp.Websites.Twitter

-- Code --
comp.MainFrame.UrlBar.FocusLost:connect(function()
    input = comp.MainFrame.UrlBar.Text
if input == "youtube.rbx" or input == "www.youtube.rbx" or input == "http://youtube.rbx" then
    youtube.Visible = true
    notice.Visible = true
    notice:TweenPosition(UDim2.new(0, 100,0, 300), "Out", "Quad")
    wait(4)
    notice:TweenPosition(UDim2.new(0, 0,0, 0), "Out", "Quad")
    wait(2)
    notice.Visible = false
elseif input == "roblox.rbx" or input == "www.roblox.rbx" or input == "http://roblox.rbx" then
    roblox.Visible = true
    notice.Visible = true
    notice:TweenPosition(UDim2.new(0, 100,0, 300), "Out", "Quad")
    wait(4)
    notice:TweenPosition(UDim2.new(0, 0,0, 0), "Out", "Quad")
    wait(2)
    notice.Visible = false
elseif input == "twitter.rbx" or input == "www.twitter.rbx" or input == "http://twitter.rbx" then
    twitter.Visible = true
    notice.Visible = true
    notice:TweenPosition(UDim2.new(0, 100,0, 300), "Out", "Quad")
    wait(2)
    notice:TweenPosition(UDim2.new(0, 0,0, 0), "Out", "Quad")
    wait(2)
    notice.Visible = false
else
    comp.MainFrame.UrlBar.Visible = false
    comp.MainFrame.UrlError.Visible = true
    comp.Websites.YouTube.Visible = false
    comp.MainFrame.UrlError.Text = "ERROR: Url Not Found!"
    wait(4)
    comp.MainFrame.UrlError.Visible = false
    comp.MainFrame.UrlBar.Visible = true
    end
end)
0
Yes on both, i've tried print, it works, but the gui still doesn't show while in a real server.. colefrickz 0 — 10y
0
In server, press Alt-F9. It'll show the output from the Server and your Client. Perhaps there's a problem when a server is started hiccup111 231 — 10y
0
Ok thanks, shall do. colefrickz 0 — 10y
0
Editing my post with new errors colefrickz 0 — 10y
View all comments (10 more)
0
At the beggining of the script, add this:   repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.PlayerGui:FindFirstChild("NNet") hiccup111 231 — 10y
0
No still same error...Could this just be a ROBLOX error? colefrickz 0 — 10y
0
Add a long wait time, see if still bugs out. Because sometimes LocalScripts load BEFORE the Player and stuff loads.      Either that, or add another repeat wait() until comp:FindfirstChild("Notice") hiccup111 231 — 10y
0
It's tell it's coming from LINE 4 - Where notices = comp.Notices colefrickz 0 — 10y
0
Yes it says it's not a member of ScreenGui (NNet), or hasn't loaded yet. This happens a lot, and usually a Wait fixes it. hiccup111 231 — 10y
0
I've tried both things you suggested. Nothing. colefrickz 0 — 10y
0
Any ideas? colefrickz 0 — 10y
0
Last test, put DomainChecker at the route of the Gui (NNet). hiccup111 231 — 10y
0
That worked, why was it doing that?! colefrickz 0 — 10y
0
Not sure, the DomainChecker had loaded before the gui, and just couldn't find the paths. Atleast it's fixed now. hiccup111 231 — 10y
Ad

Answer this question