#About attributes

1 messages · Page 1 of 1 (latest)

junior lava
#

So, my system works like this: once a player joins, it loads their data it will fire event to client, and if the player owns weapons, it will change the text on the buttons and set the "Owns" attribute to true (Client-Sided) .

I tried checking it like this: if button and button:GetAttribute("Owns") ~= true then, but the script still continues. I just want to make it so that if the player owns the weapon, the rest of the script won’t execute. So, I can handle weapon equipping

Local Script

for _, weapon in pairs(WeaponListFrame:GetChildren()) do
    local button = weapon:FindFirstChildOfClass("TextButton")
    if button and button:GetAttribute("Owns") ~= true then
        local UniqueID = button:GetAttribute("UniqueID")
        button.MouseButton1Click:Connect(function()
            if UniqueID then
                ShopPurchaseEvent:FireServer(UniqueID)
            end
        end)
    end
end