Disable playerlist at specific times

Hey,

I am looking for a method to disable the player list GUI at certain times, or more precise, not beeing able to open it when certain GUIs are opened.

For example, when you open a shop, you cannot open the player list anymore, but as soon as you close that gui you can open the playerlist again.

I hope you understand what I meant. So I’ve heard of this:

Game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false), but that disables the playerlist for all right?

And then I tried this:
localPlayer.PlayerGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)

But that doesnt work either, I get an error, is not valid bla bla bla.

So is there any way to make the playerlist not open for a certain period of time for ONLY one player?

So like this:

localPlayer.PlayerGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false) --can not open player list

--gui stuff etc. etc. 

localPlayer.PlayerGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true) --can open player list

Thanks for all help!

What’s the error? (30 chars lo)

You may make boolean value/variable to check when the GUI are enabled. And disable the playerlist when the value/variable is true.

All players get a copy of a local script, so all the copies are running thus everyone gets their player list disabled. I don’t know how the shop is opened, could you elaborate on that.

SetCoreGuiEnabled is not a valid member of PlayerGui

game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,false)
1 Like

Well, the gui is either: enabled = true/false, but I change the enabled value on the playerGui.

So, if I write
Game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
wouldnt that disable the the player list for all of the players?

or am I misunderstanding something @incapaxx

But wouldnt that disable it for all players and not only the one specific player? @28Y8

2 Likes

No? i guess?

2 Likes

Oh! I’ll test that out at once! I will come back to you soon, thanks!

Hey, it worked!

But, does this also disable the playerlist for mobile phones? (Touch devices?)

Mobile devices don’t have playerlist. :thinking:

2 Likes

Oh, ok, thanks!

One last question though :sweat_smile:

First of all, I have made the topbar invisible. So, when I have a below the name, it doesnt register click nor hover overs… Is there any way that the button is, like above? Or something like that.

Set IgnoreGuiInset to true in the ScreenGui properties

That doesnt seem to work :face_with_monocle:
When I for eexample hover over the button, nothing happens.
One sec, I will make a gif.

Here,
https://gyazo.com/e50abde05e6d2e5660a6faaa8c035ce6

So, when the button gets hovered over it is supposed to turn silver. But it still doesnt detect the part that is under the name/top bar.

Only works from below since that part is under the top bar.

@Firzal_VX

It’s a bit complicated. Since the TextButton Click doesn’t work on Topbar, you can make own with UserInputService and MouseEnter MouseLeave event.

local Button = script.Parent -- Button
local UserInputService = game:GetService("UserInputService")
local EnabledClick = false

local function onHover()
 EnabledClick = true
end

local function onUnhover()
EnabledClick = false
end

local function onClick(input)
 if input.UserInputType == Enum.UserInputType.MouseButton1 and EnabledClick then
  -- Mouse click code
 end
end

button.MouseEnter:Connect(onHover)
button.MouseLeave:Connect(onUnhover)
UserInputService.InputBegan:Connect(onClick)

Didn’t tried it, but hopefully work. So basically this code checks if the button is hovered, then enabledClick set to true, if not then false. And UserInputService makes click event when the enabledClick is true.

1 Like

Just add this code where the shop opens:

game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,false)

and add this code where the shop closes:

game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList,true)

Make sure it’s inside of a localscript and also make sure to mark this as a solution if this helps you out.

1 Like

Thanks, kind of annyoing that the topBar is so intrusive in UI work and design.

Anyways, i’ll probably not do that.

Thanks for the help so far!

Thats because roblox dont want us really modify the topbar :thinking:

1 Like