Wanted to make the ClassGUI re-appear again when player respawns

Hi, I am making a whole mechanism for a group game of mine I am facing the following issues below:

  1. The issues

I had my classLoadout GUI Enable properties off in the beginning and it works when I click play button from the main menu but does not seem to re-appear again when the player respawn.

  1. What I want to achieve

I want my classLoadout GUI re-appear again when the player respawns.

  1. Solutions

Seeking for help from DevForum.

Code source:

local Players = game:GetService("Players")

local player = Players.LocalPlayer
local playerGui = player.PlayerGui
local cam = workspace.CurrentCamera
local Controls = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls()
local UserInputService = game:GetService("UserInputService")

script.Parent.MouseButton1Click:Connect(function()
	--wait()
	cam.CameraType = Enum.CameraType.Custom
	cam.FieldOfView = 70
	player.PlayerScripts:WaitForChild("MenuCameraLocalScript"):Destroy()
	player.PlayerScripts:WaitForChild("CamFOV"):Destroy()
	playerGui:WaitForChild("ScriptsGui"):Destroy()
	--playerGui:WaitForChild("CameraRigScript"):Destroy()
	--playerGui:WaitForChild("DDD"):Destroy()
	--playerGui:WaitForChild("Language"):Destroy()
	playerGui:WaitForChild("MenuGui"):Destroy()
	playerGui:WaitForChild("PAKTCGui"):Destroy()
	playerGui:WaitForChild("StudioLogo"):Destroy()
	playerGui:WaitForChild("ClassGui").Enabled = true
	Controls:Enable()
	UserInputService.MouseDeltaSensitivity = 1
	game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
	game.StarterGui:SetCore("ResetButtonCallback" ,true)
end)

P.S: The name of the gui is “ClassGui” and if you’re wondering that I enabled the ResetOnSpawn properties or not the answer is yes.

1 Like

Have you tried enabling the ResetOnSpawn setting in the ScreenGui?

If you want a demonstration, here’s the LocalScript source code that I made to make the frame invisible. It must reappear again when the player resets or dies.

local frame = script.Parent
local button = frame.TextButton

button.MouseButton1Click:Connect(function()
    frame.Visible = false
    game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = false
end)

Or are you referring to whenever the ScreenGui itself is disabled, not the frame?

plr:GetPropertyChangedSignal(“Character”):Connect(YourFunctionHere)

The screengui itself is disabled and the ResetOnSpawn has been enabled as I mentioned in the topic. What I want was to make a function that the ClassLoadoutGui re-appear again when the player respawns.

1 Like

Oh, alright. Apologies on my end, we can use the LocalPlayer.CharacterAppearanceLoaded() function to re-enable the ScreenGui.

LocalPlayer.CharacterAppearanceLoaded:Connect(function(char)
    if char then
        print("Reseted character successfully loaded!")
        -- Re-enable ScreenGui (ScreenGui.Enabled = true)
    end
end)

When the character’s loaded into the game (particularly after the player dies or smth), the event will fire.