I need help with ui code

i want to make it so when the plr is on a certain tab the topbar is highlighted with the hoverimage of the btn like this


it works for the products but not for the gamepass

heres myt code `
– // services
local replicatedStorage = game:GetService(“ReplicatedStorage”)
local players = game:GetService(“Players”)

– // assets
local components = replicatedStorage:WaitForChild(“UI”):WaitForChild(“Components”)

– // variables
local plr = players.LocalPlayer
local plrGui = plr:WaitForChild(“PlayerGui”)

– // modules
local uiModule = require(components:WaitForChild(“UI”))
local constants = require(replicatedStorage.UI.Constants.Constants)

– // private function
local function freezeHold(ImageButton: ImageButton, Action: string, Type: string)
if not ImageButton or not Action then
return
end

print(ImageButton)

local StackHold
local StackNormal

if Type == "Gamepass" then
	StackHold = constants.Holds.Gamepass
	StackNormal = constants.Normals.Gamepass
else
	StackHold = constants.Holds.Products
	StackNormal = constants.Normals.Products
end

if Action == "EnableHold" then
	print(StackNormal)
	if StackHold then
		ImageButton.Image = StackHold
	end

elseif Action == "DisableHold" then
	if StackNormal then
		ImageButton.Image = StackNormal
	end
end

end

local function _callback(self)
self.CurrentTab = “Gamepass”
self.UIInstance = plrGui:WaitForChild(“UI”):WaitForChild(“Store”)

if not self.UIInstance then
	return 
end

local Frames = {
	Gamepass = self.UIInstance.Screen.Gamepasses,
	Products = self.UIInstance.Screen.Products
}



if self.UIInstance.Enabled == false then
	self.UIInstance.Enabled = true
end



if self.CurrentTab == "Gamepass" then
	if not Frames.Gamepass.Visible then
		Frames.Products.Visible = false
		Frames.Gamepass.Visible = true
		freezeHold(self.UIInstance.Screen.Categories.Gamepasses.Background, "EnableHold", "Gamepass")

	end
else
	if not Frames.Products.Visible then
		Frames.Gamepass.Visible = false
		Frames.Products.Visible = true
		freezeHold(self.UIInstance.Screen.Categories.Products.Background, "EnableHold", "Products")

	end
end

end

local uiInstance = uiModule.new({
__callBack = _callback,
UI = “Store”
})

uiInstance:setup()

warn(“Store setup complete”)
return true

1 Like

Format the code properly first.