I am making a title screen for my game and I decided to put a little twist on mine by making it so that the camera is panned on a wall and the buttons for starting the game or viewing the "Help" screen are SurfaceGuis on the wall rather than ScreenGuis. However, let's say somebody clicks on the "Help" gui - how can I make it so that the frame only appears on the player's side rather than everyone's side?
These are my two scripts for the "Help" gui. (My game is filtering enabled, so I'm using Remote Events.)
LocalScript in the StarterPack:
player = game.Players.LocalPlayer --Scripts for hovering over the buttons and clicking them game.Workspace.StartMenuArea.Room.Board.TitleGui.Help.MouseButton1Click:connect(function() game.Workspace.StartMenuArea.Room.Board.TitleGui.Help.OnClick.Clicked:FireServer() end) game.Workspace.StartMenuArea.Room.Board.TitleGui.Play.MouseButton1Click:connect(function() game.Workspace.StartMenuArea.Room.Board.TitleGui.Play.OnClick.Clicked:FireServer() end) game.Workspace.StartMenuArea.Room.Board.TitleGui.Help.MouseEnter:connect(function() game.Workspace.StartMenuArea.Room.Board.TitleGui.Help.OnHover.MouseEnter:FireServer() end) game.Workspace.StartMenuArea.Room.Board.TitleGui.Help.MouseLeave:connect(function() game.Workspace.StartMenuArea.Room.Board.TitleGui.Help.OnHover.MouseLeave:FireServer() end) game.Workspace.StartMenuArea.Room.Board.TitleGui.Play.MouseEnter:connect(function() game.Workspace.StartMenuArea.Room.Board.TitleGui.Play.OnHover.MouseEnter:FireServer() end) game.Workspace.StartMenuArea.Room.Board.TitleGui.Play.MouseLeave:connect(function() game.Workspace.StartMenuArea.Room.Board.TitleGui.Play.OnHover.MouseLeave:FireServer() end)
The script for clicking on the Help button.
script.Clicked.OnServerEvent:connect(function() if script.Parent.Parent.HelpFrame.Visible == true then script.Parent.Parent.HelpFrame.Visible = false else script.Parent.Parent.HelpFrame.Visible = true end end)
Any help is always appreciated!
Put the surfacegui inside of the PlayerGui and set the Adornee value to the part you want to stick it on. All localscripts can then easily get the surfacegui by game.Players.localPlayer.PlayerGui.SurfaceGui
- or whatever the name of your surfaceGui is.