Doesn’t seem like there’s 60 lines in the code you provided. Are you sure the code you showed is from PlayerScripts.LocalScript
?
HERE IS MY UPDATED CODE:
local Player = game:GetService("Players").LocalPlayer
local GroupId = 11587846
local rank = Player:GetRoleInGroup(GroupId)
local rankid = Player:GetRankInGroup(GroupId)
local player = game:GetService("Players").LocalPlayer
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.Value
local musicsong2 = 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)
:bindEvent("deselected", musicsong:Changed:Connect(function(value)
Icon:setLabel(musicsong, "hovering")
Icon:setLabel(musicsong, "deselected")
Icon:setLabel(musicsong, "selected")
end))
:bindEvent("deselected", musicsong:Changed:Connect(function(value)
Icon:setLabel(musicsong, "hovering")
Icon:setLabel(musicsong, "deselected")
Icon:setLabel(musicsong, "selected")
end))
What are you doing here…? I have no idea, and I guess this is problem
I have a string value in the workspace, and when it changes I want the label to update…
That is how i was told you can do it.
I don’t think this is correct.
musicsong:Changed:Connect(function(value)
Icon:setLabel(musicsong, "hovering")
Icon:setLabel(musicsong, "deselected")
Icon:setLabel(musicsong, "selected")
end)
This code is wrong too. I don’t know what you want to do.
I recommend you learning lua.
Ok tell @ForeverHD that basted of he told me to use this… Bro just be useful next time you talk to me your clearly lieing.
I’m not lying (That will be illegal in devforum), Because I really don’t know what you want to do with this code.
Why you are calling setLabel in 3 times continus, And binding event to connect function, witch returns nil.
I think what part of what @dollychun is trying to say is that you are changing the icon 3 times without any wait, so that the end result is it almost instantly going to selected.
i dont care, I just need it to stop erroring on the top line of that icon…
Also, binding event to nil that connect returns.
Because they wont know about it unless they use the script modules…
You must care to fix errors! thats not how script works
(post withdrawn by author, will be automatically deleted in 1 hour unless flagged)
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)