Comments (10)
I can't replicate. Here is a place where it works for me.
Wait 5 sec and you will see the topbar go away and then 5 sec after it will come back.
https://drive.google.com/file/d/16v4vmxysWvlYb9KI1Ll3w93C3Iy0mZHF/view?usp=sharing
from core.
Though maybe placing the guis in replicated storage or something, then letting a script on the client clone it would be good. As that would not require the player to spawn either, and it saves server resources.
from core.
This sounds as if the DirectoryService is incorrectly loading Topbar+ due to your particular method, as apposed to there being an issue with the Icon and icon:setTopbarEnabled()
.
Are you able to provide a repo place file of this bug?
from core.
Small video of the issue in action:
(Had to zip it because otherwise GitHub would not let me upload it as OBS recorded it as a .mkv file)
ReproVideo.zip
Seems to place-specific as a baseplate doesn't give out this issue.
Test button code:
local c = true
script.Parent.MouseButton1Click:Connect(function()
c = not c
if c then
script.Parent.Text = "Disable Topbar"
else
script.Parent.Text = "Enable Topbar"
end
local Test = game:GetService("Players").LocalPlayer.PlayerGui:WaitForChild("Topbar+")
if not Test:FindFirstChild("WaitReturn") then -- Make a value on the GUI that is returned by WaitForChild.
local x = Instance.new("StringValue")
x.Name = "WaitReturn"
x.Parent = Test
end
print("In")
local BaseHD = game:GetService("ReplicatedStorage"):WaitForChild("HDAdmin"):WaitForChild("Topbar+")
local Topbar = require(BaseHD:WaitForChild("IconController"))
Topbar:setTopbarEnabled(c)
print("Out")
end)
from core.
Your client icon creator is fine, it's how you're loading Topbar+ which is almost certainly the issue, in particular this:
The Topbar+ server (i.e. DirectoryService) automatically handles the cloning of GUIs into a player's PlayerGUI. By cloning this yourself, the Topbar+ GUI is being cloned twice, which is creating all the issues mentioned above.
For an ideal setup:
- Topbar+ can be initiated in a Script in ServerScriptService with
require(4874365424)
- Your icon creator local script should be placed within StarterPlayerScripts
from core.
Ok, reading DirectoryService
, the conflict is that DirectoryService
initializes the GUI into PlayerGui
as you say, however, it waits until a character is spawned. In my loading script, I clone it BEFORE the character spawns, and since DirectoryService
runs on the server, it will not see the client copy of the GUI, therefore cloning it again.
Meanwhile, I have a local variable with the GUI, I will have the client hook the PlayerGui
and destroy the duplicate.
from core.
Due to the way Roblox initialises their player, the 'early-joiners' system within the DirectoryService has to wait until the character has loaded plus one heartbeat before cloning in the Topbar+ GUI.
Can you explain in more detail why you're creating a duplicate in the first place? Can you not simply wait until the original GUI is loaded in and reference that instead?
from core.
I think it is cleaner to load the topbar now rather than on character spawn, so when the character is spawned, everything is already loaded in, also, I have my Backpack, Admin Panel and Main UI modules create the icons as part of the game loading process (not to mention that my Backpack script hooks the B button to the Icon).
from core.
Without forking this repository to create your desired effect, there isn't much else that can be done at this point in time. Do consider, Topbar+ only waits for the character for players who join really fast (i.e. maybe the first 1 to 2 players at most). For others, the Topbar+ GUI is added when their player instance is added.
In the future, my plan is to scrap the DirectoryService completely and have projects (such as Topbar+) initialised in studio via a plugin (as apposed to live in-game through a MainModule) to help in situations like yours.
from core.
Meanwhile, I will use the solution to remove the GUI that DirectoryService clones, as far as I tested, removing the duplicate solves the main problem: setTopbarEnabled
About forking the repository, I might make a pull request for this.
Thanks for the information. I will close this issue for now.
from core.
Related Issues (20)
- Setup UI Plan
- Update internal data and user systems before continuing work
- REMOVE THE ICE CREAM VAN (KIDNAP COMMAND) IMPORTANT!! HOT 5
- Nanocoins (N$) (or Nanobux or Nanobucks)
- Update GitHub Publish Action to use the new Open Cloud instead of a standalone dedicated account
- Setup CONTRIBUTING HOT 1
- HD Admin Not Working - Infinite Yield Possible on ReplicatedStorage:WaitForChild("HDAdminSetup") HOT 8
- Messages: an enhanced form of communication
- Finalise Users/Profiles, Globals and Central Server Overhaul
- SystemService and Commands Overhaul
- Update Docs
- Localization
- Setup a Bounty program
- Design Official Logo
- Option to automatically make test players in studio X rank HOT 1
- Produce tutorials
- Convert codebase to typed luau
- Make server and local script command (PLUS EXTRAS)
- HD Admin [STOPPED WORKING RANDOMLY] Infinite Yield Possible on 'ReplicatedStorage:WaitForChild("HDAdminClient")'
- [HD Admin] Type confusion + numerical values in `Contributors` command field results in error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.