TopBarPlus V3 Menu tween not working

I’m trying to make a menu that tweens open which works but when pressing again it doesn’t tween close, it just disappears instead of tweening.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Icon = require(ReplicatedStorage.Icon)
local Icon1 = Icon.new()
local PlayerGui = game:GetService("Players").LocalPlayer.PlayerGui
local Panel = PlayerGui:WaitForChild("AdminPanel").Frame.AdminPanel

Panel.Position = UDim2.new(-1, 0, 0.164, 0)
Icon1:setName("Admin Panel"):setImage(6594776225):bindToggleItem(Panel)
Icon1:setLabel("Admin")

Icon1.selected:Connect(function()
	Panel:TweenPosition(UDim2.new(0.164, 0, 0.164, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true)
end)

Icon1.deselected:Connect(function()
	Panel:TweenPosition(UDim2.new(-1, 0, 0.164, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true)
end)

1 Like

It seems you’ve connected 2 listeners to a single event, instead connect one listener and add logic inside to determin which tween to use, see if that works.

Oh, sorry I accidently put the wrong thing, it was supposed to be Icon1.selected and Icon1.deselected, not both Icon1.selected

Turns out deselected just wasn’t working properly but doing what you suggested seems to fix it when using Icon1:onClick() with it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.