Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does my GUI not appear?(FE compatible)

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

1 comment

0

I think It should be FireClient() and the Script and Local Script should be swapped around.

1 answer

✓ Accepted answer

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!

6 comments

0

Sounds good,I will try it

0

Btw can you tell me when do I need remote events and when i do not

0

You need remote events when you need client-server communication and server-client communication. Also, please accept my answer!

0

Thx it works now

0

the output says attempt to index global play

0

Use my edit.

This discussion is preserved as it was. New answers, comments, and votes are closed.