Problem with TopbarPlus

I’m trying to use TopBar Plus, but every time my player dies or resets, it duplicates the dropdowns (I’ve already tried passing an empty array as the API requests but it didn’t work). Any good soul could help me?

ScreenShots


Script:

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Values = Character:WaitForChild("Values")
local CharSelect = Values:WaitForChild("Character")
local Humanoid = Character:WaitForChild("Humanoid")

local TopBar = require(game.ReplicatedStorage.GUI:WaitForChild("Icon"))

local CharSelect = TopBar.new()
CharSelect:setImage(16346990319)
CharSelect:setTip("Select Your Character")
CharSelect:setDropdown({
	
	TopBar.new()
		:setLabel("Cursed Vessel")
		:setImage(15839794681)
		:bindEvent("selected", function()
		if Humanoid.Health == Humanoid.MaxHealth then
			CharSelect.Value = "Cursed Vessel"
			script.Click:Play()
		else
			script.Bad:Play()
		end
	end),

	TopBar.new()
		:setLabel("Ultimate Saiyan")
		:setImage(17852319405)
		:bindEvent("selected", function()
		if Humanoid.Health == Humanoid.MaxHealth then
			CharSelect.Value = "Ultimate Saiyan"
			script.Click:Play()
		else
			script.Bad:Play()
		end
	end),
	
	TopBar.new()
		:setLabel("Man that punches")
		:setImage(17852319405)
		:bindEvent("selected", function()
		if Humanoid.Health == Humanoid.MaxHealth then
			CharSelect.Value = "Man that punches"
			script.Click:Play()
		else
			script.Bad:Play()
		end
	end),
	
	TopBar.new()
		:setLabel("Whats your type?")
		:setImage(17852319405)
		:bindEvent("selected", function()
		if Humanoid.Health == Humanoid.MaxHealth then
			CharSelect.Value = "Whats your type?"
			script.Click:Play()
		else
			script.Bad:Play()
		end
	end),
	
	TopBar.new()
		:setLabel(" Nah, I'd Win.")
		:setImage(17852319405)
		:bindEvent("selected", function()
		if Humanoid.Health == Humanoid.MaxHealth then
			CharSelect.Value = "Nah, I'd Win."
			script.Click:Play()
		else
			script.Bad:Play()
		end
	end)
})

Humanoid.Died:Connect(function()
	CharSelect:Destroy()
end)

Make sure your LocalScript is in a container that doesn’t reset upon spawning, like StarterPlayerScripts.

1 Like

Even in StarterPlayerScripts it won’t work properly. The button simply doesn’t work at all!