Say there’s a script for a custom menu I made, that makes a TopbarPlus icon, but the developer of the game has a separate script that requires a different TopbarPlus script, would they still work with each other?
Yeah why not!
If I understand what you said correctly, you can do it like this as an example
The script that creates TopbarPlus icon:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local iconModule = ReplicatedStorage:WaitForChild("Icon")
local Icon = require(iconModule)
shared.FriendInviteIcon = Icon.new()
:setName("FriendInvite")
:setImage("rbxasset://textures/ui/PlayerList/FriendIcon@3x.png")
:oneClick()
:bindEvent("selected", function(self)
print(("%s has selected"):format(self.name))
end)
The other sepate script that makes the TopbarPlus icon selected every 1 second
while true do
if shared.FriendInviteIcon then
shared.FriendInviteIcon:select()
end
task.wait(1)
end
Note: if you don’t have to do this in separate code It is preferable to use icon:call(func)
I’ve made a cash counter for anyone who can’t figure out how to make one (if you use it credit is appreciated but you dont have to!) https://create.roblox.com/store/asset/16858596240/Cash-Counter-TopbarPlus-V3
v3 is currently bugged for Controller players on my game, they were stuck on a Topbar Button and couldn’t reach or select the Play button.
Video of this happening:
My script:
local PlayerService = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = PlayerService.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local Modules = ReplicatedStorage:WaitForChild("Modules")
local CombatLog = ReplicatedStorage:WaitForChild("CombatLog")
local CombatTag = CombatLog:WaitForChild(Player.Name, math.huge):FindFirstChild("CombatTag")
local TopbarPlusModule = require(Modules.Icon)
local NotificationModule = require(Modules.NotificationModule)
local debounce = false
TopbarPlusModule.new()
:align("Right")
:setImage(14333878755)
:setCaption("Cinematic Mode")
:modifyTheme({"Widget", "BorderSize", 0})
:bindEvent("selected", function(icon)
local Character = Player.Character
if not Character:GetAttribute("inMenu") then
PlayerGui.MainHUD.Enabled = false
PlayerGui.Leaderboard.Enabled = false
PlayerGui.MiscHUD.Enabled = false
end
end)
:bindEvent("deselected", function(icon)
local Character = Player.Character
if not Character:GetAttribute("inMenu") then
PlayerGui.MainHUD.Enabled = true
PlayerGui.Leaderboard.Enabled = true
PlayerGui.MiscHUD.Enabled = true
end
end)
TopbarPlusModule.new()
:align("Right")
:setImage(11713331505)
:setName("Backpack")
:setLabel("Backpack")
:bindToggleKey(Enum.KeyCode.Backquote)
:modifyTheme({"Widget", "BorderSize", 0})
:bindToggleItem(PlayerGui:WaitForChild("MainHUD", math.huge):WaitForChild("Inventory"))
TopbarPlusModule.new()
:align("Right")
:setImage(9405925508)
:setCaption("Return to Menu")
:modifyTheme({"Widget", "BorderSize", 0})
:bindEvent("selected", function(icon)
local Character = Player.Character
if #CombatTag:GetChildren() == 0 and not Character:GetAttribute("Attacking") and not Character:GetAttribute("Stunned") then
if not debounce then
PlayerGui:WaitForChild("MenuScreen").returnMenu:Fire()
debounce = true
task.delay(2, function()
debounce = false
end)
end
else
NotificationModule.Notification(Player, "<Font=GothamBold><ContainerHorizontalAlignment=Center><TextScale=1><Color=White>You are currently <Color=Red><AnimateStyle=Wiggle><AnimateStepFrequency=1><AnimateStyleTime=2>in-Combat!")
end
end)
:bindEvent("deselected", function(icon)
local Character = Player.Character
if not Character:GetAttribute("inMenu") then
PlayerGui.MainHUD.Enabled = true
PlayerGui.Leaderboard.Enabled = true
PlayerGui.MiscHUD.Enabled = true
end
end)
If you setup the V3 from the playground, will it automatically update like a package or what’s it called? So the only downside to using it now would be that it’s slightly unstable maybe and there’s some fixes that are needed but other than that it’s good to go, right? I think I might still have to wait though because I’m a pretty horrible scripter and without documentation of how it is now I have no idea what I’m doing haha (I did actually try switching to V3 real quick out of boredom but nothing worked )
Yep the package directly from the playground is stable and ready for production! I’ll be releasing v3 in about 3 days.
I’ve just completed the v3 docs minus API Events and API Properties which I’ll complete tomorrow:
There’s a new section under Installation which explains how to receive automatic updates to your package
Will explore this tomorrow, thanks for your report.
Ah understood, and yep topbarplus provides support for multiple packages within a single experience (assuming they’re both v3 packages). More details on this here:
Good spot. It should contain a dropshadow already so will look into this.
Hey Ben!
It would be great if you could add something that works opposite to bindToggleItem
.
like this:
icon.deselected:Connect(function()
shopFrame.Visible = true
end)
icon.selected:Connect(function()
shopFrame.Visible = false
end)
For example, the best example to do this for closing and opening interface
The video:
Hi! I likely won’t add this due to its limited use, but thanks for the suggestion. If you’d like a more optimal method you can do:
icon:bindEvent("toggled", function(icon, isSelected)
shopFrame.Visible = not isSelected
end)
I don’t work with roblox-ts anymore. If you want a TS port then someone else can take up that mantle and I’ll happily give over the package perms on NPM.
Hey Ben!
the first argument of the toggle event is gives the icon. not the booelan.when will this be fixed?
do you possibly happen to know anyone who could do this
I don’t know, I’m not in the roblox-ts community anymore. You should join the roblox-ts Discord server and ask there.
Ha apologies, this isn’t a bug, it’s me typing by sight too quickly. bindEvent always passes the icon as first argument then everything else (…) so it should be instead:
icon:bindEvent("toggled", function(icon, isSelected)
shopFrame.Visible = not isSelected
end)
Can you also make this caption hint work with combinations like CTRL+V
A quick fix but worth noting - dropdown menus on the right of the screen seem to appear behind the PlayerList in the new test version. In the previous version, this would automatically hide the PlayerList and I think this is a feature worth incorporating into the new version too to avoid having to fork and edit the package code.
Was the controller issue regarding TopbarPlus v3 ever resolved?
Just in case this wasn’t seen, could this still be considered?
Added, thanks for the suggestion
I’ve been exploring how to reproduce but with no luck so far. Will follow up with a DM