I need help with my script

It seems I still have a problem with my script. So can anyone help?
Here is my script:

script.Parent.MouseButton1Click:Connect(function()

game.PlayerGui:FindFirstChild(“JoinGame”).Visible = false

game.PlayerGui:FindFirstChild(“CreateGame”).Visible = true

end)

The game does not have the PlayerGui LOL

You have to reference that instead using a LocalScript, inside where your GUI is since the PlayerGui is only available client sided:

local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local JoinGame = PlayerGui:WaitForchild("JoinGame")
local CreateGame = PlayerGui:WaitForChild("CreateGame")

script.Parent.MouseButton1Click:Connect(function()
    CreateGame.Enabled = true
    JoinGame.Enabled = false
end)
1 Like

Oh thanks for your help I tried doing other things, but it didn’t work.

Wait a second ScreenGui’s don’t have a Visible property

That should be changed to Enabled instead, I edited the code

nothing such as playergui in the game lol
instead do some waitforchild thingamabob

1 Like

are you using a local script? Local scripts are to refer to local players. Scripts are used to refer to your games engine.