Hi, hello, it was Tuesday and i finally made a main menu for my game. It looks nice and cool and the buttons are working perfectly. But i have a problem.
The player can do suicide, and that will ruin the GUI. Why?
After suicide, apparently the StarterGUI reloads itself with it's default state .I mean such as, whether the ScreenGUI inside it is enabled or not. e.g: i set the HUD ScreenGUI to be enabled by default, and disabled it when a player joins, only enabling it after they hit play. But if the player does suicide, the default state loads, and the main menu will be overlaid with the HUD's GUI.
The player can fiddle around with the camera setting in the Roblox settings (such as follow, classic, and default kinda stuff), and when they do the camera just, messes up. (My main menu has a camera set on a part's CFrame)
The default gui is still on. The slotbar and the chat and the inventory, it's still there. I haven't looked about how to disable it.
And that's about the problems that I'm currently having. Any help, is much appreciated. Thanks.
Also i'm sorry if my wording is bad, because i'm not good at English.
hello,
your last two are more straightforward, so I will answer them first.
2) what you want is DevComputerCameraMode
. try player.DevComputerCameraMode = Enum.DevComputerCameraMovementMode.Scriptable
(serverscript only). be sure to switch it back afterwards.
3) simple. check out this post (localscript only). however, this will temporarily disable the chat, inventory, etc. except for the menu.
as for the suicides, I have not actually worked with guis before... at all, so I will give two solutions in case one is impossible. someone more experienced might have a better solution.
1A) you may want to keep a value on the player to decide which gui they spawn with. so you can set their default gui as the main menu by default, but rotate this out to hud when they hit play, rather than always have the hud as starter.
1B) if that is not possible because you cannot change the starting gui, use a CharacterAdded event in combination with a value that tells you whether to hide the hud or not. if they are in the menu, turn this on. when they hit play, turn it off.