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

Why does my GUI not appear?(FE compatible)

Asked by 6 years ago

Ok so I have this GUI.It shows the players information like currency.So what i want it to do is that I want it to appear when the player clicks on the Button.However,it works in studio.But not in game.When it is tested in game.The output says

Info is not a valid member of playergui

So info is the screengui and what is inside is a frame Which i want it to be visible

I checked it in studio and it was in the right place.I don't know what is wrong.

Local script

script.Parent.MouseButton1Click:connect(function()

    game.ReplicatedStorage.IngameinfoGUIHandler:FireServer()
end)

Script

game.ReplicatedStorage.IngameinfoGUIHandler.OnServerEvent:connect(function(player) 
    local gui = player.PlayerGui.Info
    if gui.main.Visible == true then
        gui.main.Visible = false 
    elseif
        gui.main.Visible == false then
        gui.main.Visible = true
    end
end)

Can anyone tell me what is wrong? I don't have a lot of knowledge on filtering enabled

0
I think It should be FireClient() and the Script and Local Script should be swapped around. xEiffel 280 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

You do not need or want remotes, as you can handle this on ONLY the client. So, your localscript should be

script.Parent.MouseButton1Click:Connect(function()
        local gui = game.Players.LocalPlayer.PlayerGui.Info
        if gui.main.Visible == true then
            gui.main.Visible = false 
        elseif
            gui.main.Visible == false then
            gui.main.Visible = true
        end
end)

Hope this helps!

0
Sounds good,I will try it KawaiiX_Jimin 54 — 6y
0
Btw can you tell me when do I need remote events and when i do not KawaiiX_Jimin 54 — 6y
0
You need remote events when you need client-server communication and server-client communication. Also, please accept my answer! hiimgoodpack 2009 — 6y
0
Thx it works now KawaiiX_Jimin 54 — 6y
View all comments (2 more)
0
the output says attempt to index global play KawaiiX_Jimin 54 — 6y
0
Use my edit. hiimgoodpack 2009 — 6y
Ad

Answer this question