This experience has many places to go and so I have added Teleport button on the righthand side so that a player can open/close the menu frame shown below by clicking or tapping.
The issue is related to how you defined the variable, as suspected.
The version you are modifying the visibility of is StarterGUI, however you should be accessing PlayerGui instead!
Just replace StarterGui with game.Players.LocalPlayer.PlayerGui, or using your existing variables, player.PlayerGui