When i press a button it opens a gui up but it isnt working

16:16:26.941 Players.planets0001.PlayerGui.ScreenGui.OpenButton.LocalScript:1: Expected identifier when parsing expression, got ‘)’ - Studio - LocalScript:1
16:16:26.941 Players.planets0001.PlayerGui.ScreenGui.Frame2.CloseButton.LocalScript:1: Expected identifier when parsing expression, got ‘)’ - Studio -
That is the output.
image
OBJECTS

2 Likes

try this it’s simple but it will help you

local Player 	= game:GetService("Players").LocalPlayer

local PlayerGui = Player.PlayerGui

local Frame  	= PlayerGui.ScreenGui.Frame --// This is the Frame you want to Open //--

local Button 	= PlayerGui.ScreenGui.OpenButton

local IsOpen	= false

Button.Activated:Connect(function()
	if not IsOpen then
		IsOpen = true
		Frame.Visible = true
	else
		IsOpen = false
		Frame.Visible = false
	end
end)
2 Likes

Will it completely fix it and where would do i need to put it.

1 Like

in the localScript
image

Ah ok thank you. I have other scripts should i get rid of them. They are in the local gui

1 Like

yes you can remove them if you don’t need them

ok should that completely fix it?

can you show me the script inside the Localscript

local Player = game:GetService(“Players”).LocalPlayer

local PlayerGui = Player.PlayerGui

local Frame = PlayerGui.ScreenGui.Frame --// This is the Frame you want to Open //–

local Button = PlayerGui.ScreenGui.OpenButton

local IsOpen = false

Button.Activated:Connect(function()
if not IsOpen then
IsOpen = true
Frame.Visible = true
else
IsOpen = false
Frame.Visible = false
end
end)

It seems like it doesnt work sadly for some reason

Which Frame you want to open by clicking the button

Can you be a little more specific on how you want it to work

1 Like

Sorry for the lack of specific frame is the button to press to get to frame 2

Can I see your script? I might be able to fix it.

the script is what he showed me

Hello there!

The script:

local Player = game.Players.LocalPlayer

local PlayerGui = Player.PlayerGui

local Frame = PlayerGui.ScreenGui.Frame --// This is the Frame you want to Open //–

local Button = PlayerGui.ScreenGui.OpenButton

Button.Activated:Connect(function()
	Frame.Visible = not Frame.Visible
end)

It should work now!

Ok thank you so much for that!!

do i put that in server script service or no??

No, just change the text in local script.

Ok thank you so much for ru time

1 Like