Help with Topbarplus2

Don’t being rude, You will get moderation.
I’m just here to fix your errors, and you are trying to NOT fix errors…

(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)

The error clearly states that the second parameter to the function takes a function, but you seem to be passing a RBXScriptConnection instead. I don’t know what your main goal is here, so the modification I’d do is this:

:bindEvent("deselected", function()
	Icon:setLabel(musicsong, "hovering")
	Icon:setLabel(musicsong, "deselected")
	Icon:setLabel(musicsong, "selected")
end)

I am trying to make it so that when musicsong is updated in workspace it will update on the topbar… Can you help me with this?

I am not sure why you are using :bindEvent then. Dont you just want to go

Musicsong.Changed:Connect(function()
	Icon:setLabel(musicsong, "hovering")
	Icon:setLabel(musicsong, "deselected")
	Icon:setLabel(musicsong, "selected")
end)

read the docs, I have to use it…

Also i tried that and it didnt work.

Indeed bindEvent takes a function as the second parameter, not a RBXScriptConnection (based on the documentation). I’ve never used TopbarPlus, so I have zero knowledge, but I assume your code will be similar to this:

musicsong.Changed:Connect(function() -- Firstly, this is incorrect. Because this will listen to ANY changes in this instance. You should use :GetPropertyChangedSignal("Property") instead.
    Icon:setLabel(Label, IconName)
end)

I have read them it didnt say anything about using :BindEvent

I tried this however i got this.

your wrong, musicsong is workspace.currentsong.Value sir/madam.

Oh, true. But did you even try the approach yet? I seem to have obtained more information and think I can help more now.

Also i have tried that however it wasnt changing it but no errors.

So either Musicsong or the .changed event do not exist. Check that you didnt type it in wrong, because I cant help if they dont exist, Im only working with what I have been told does exist.

Hi Kieranl, have a try with this:

:bindEvent("deselected", function(icon)
	icon:setLabel(musicsong, "hovering")
	icon:setLabel(musicsong, "deselected")
	icon:setLabel(musicsong, "selected")
end)

This will make it so it is updated when it changes correct?

That one is binded to the deselected event. There’s also a toggled event which fires when selected and deselected. You can find all the event names here:

How do i make it so that when musicsong is changed the text will change?

This should do the trick:


local GROUP_ID = 11587846
local player = game:GetService("Players").LocalPlayer
local rank = player:GetRoleInGroup(GROUP_ID)
local rankid = player:GetRankInGroup(GROUP_ID)
local playerGui = player.PlayerGui 
local gui = playerGui:WaitForChild("settings")
local settings1 = gui.settings
local credits = playerGui:WaitForChild("credits").credits
local Icon = require(game:GetService("ReplicatedStorage").Icon)

local musicsong = workspace.currentsong

if rankid == 0 then
	rank = "✅| Visitor"
end

Icon.new()
	:setName("rank")
	:setRight()
	:lock()
	:setSize(100, 32)
	:setImage(7199868835)	
	:setLabel(rank, "deselected")
	:setLabel(rank, "selected")
	:setLabel("RankID: " .. rankid, "hovering")


Icon.new()
	:setName("Settings")
	:setImage(7202333684)
	:setCaption("Settings(g)")
	:bindToggleKey(Enum.KeyCode.G)
	:bindEvent("selected", function()
		settings1.Visible = true
	end)
	:bindEvent("deselected", function()
		settings1.Visible = false
	end)


Icon.new()
	:setName("Credits")
	:setImage(7199802249)
	:notify()
	:setRight()
	:setCaption("Credits(c)")
	:bindToggleKey(Enum.KeyCode.C)
	:bindEvent("selected", function()
		credits.Visible = true
	end)
	:bindEvent("deselected", function()
		credits.Visible = false
	end)



Icon.new()
	:setName("Current-Song")
	:setImage(7203694787)
	:setMid()
	:lock()
	:setSize(100,32)
	:give(function(icon)
		musicsong.Changed:Connect(function(value)
			icon:setLabel(value)
		end)
	end)
2 Likes

Thank you very much… If I need help again I will let you know!