After the player dies, they can't open this gui anymore. It's really annoying

wait(4)
local Player = game.Players.LocalPlayer
local NonStats = Player.NonStats
local GroupRankValue = NonStats.GroupRankValue
local mouse = Player:GetMouse()

GroupRankValue.Value = Player:GetRoleInGroup(4375377)
wait(0.5)
mouse.KeyDown:Connect(function(key)
	local Key = key:lower()
	if  Player.NonStats.Admin.Value == 1987293 then
	if key == "p" then
		if Player.PlayerGui.MainHud.ControlPanel.Visible == false then
			 Player.PlayerGui.MainHud.ControlPanel.Visible = true
		elseif Player.PlayerGui.MainHud.ControlPanel.Visible == true then
			 Player.PlayerGui.MainHud.ControlPanel.Visible = false
			end
		end
	end
end)

1 comment

0

I fixed it by using a button instead of KeyDown