#Button Activated refuses to work

1 messages · Page 1 of 1 (latest)

haughty sphinx
#

Even MouseButton1Click does not work, which is causing me just all around confusion on why this button is being so difficult. I've double checked it's z index, heiarchy, and transparency which are all correct. Any help figuring this out would be appreciated <3

local Players = game:GetService("Players")
local RepS = game:GetService("ReplicatedStorage")

local LocalPlayer = Players.LocalPlayer
local playerGui = LocalPlayer.PlayerGui
local GUI = playerGui:WaitForChild("Menus").Inventory.GUI
local HUD = playerGui:WaitForChild("HUD").HUD
local itemTemplate = playerGui.Templates.ItemSlotTemplate

local invScroll = GUI.Pocket.invScroll

local itemsData = require(RepS.Shared.Data.itemData)
local getInventoryFunction = RepS:WaitForChild("remoteFunctions"):WaitForChild("getInventory")


local playerItems = getInventoryFunction:InvokeServer()

local openInvButton = HUD.MenuOptions.InventoryButton

-- Open the Inventory
openInvButton.Activated:Connect(function()
    GUI.Visible = not GUI.Visible
end)

-- Initalize the Inventory
for itemName , itemData in pairs (itemsData) do
    if itemData.Enabled == true then
        local newItem = itemTemplate:Clone()
        newItem.Visible = false
        newItem.Parent = invScroll
        newItem.NameButton.Text = itemName
        newItem.ImageButton.Image = itemData.Image
        newItem:AddTag(itemData.Class)
        newItem.NameButton:AddTag("invItem")
        newItem.ImageButton:AddTag("invItem")
    end
end

-- Load player items
if playerItems ~= nil then
    for itemName , itemData in pairs(playerItems) do
        if itemsData[itemName].Enabled == true then
            if itemData.uses > 0 then
                local item = invScroll:FindFirstChild(itemName)
                item.Visible = true
                item.usesLabel.Text = "x" .. itemData.uses
                item.own.Value = true
            end
        end
    end
end```
slender hatch
#

Is button.Active true? Also its a localscript right?

true horizon
pulsar shale
#

.Activated Is only available for GuiButton objects In newer ui button api and It wont fire because using activated with label ui or frames wont work and make sure theres no gui with active set to true overlapping the gui, If It still doesnt work then maybe the script cant find the gui

haughty sphinx