local replicatedStorage = game:GetService("ReplicatedStorage")
local towerShop = require(replicatedStorage:WaitForChild("TowerShop"))
local UIS = game:GetService("UserInputService")
local Module3D = require(replicatedStorage:WaitForChild("Module3D"))
local getDataFunction = replicatedStorage:WaitForChild("GetData")
local player = game.Players.LocalPlayer
local gui = script.Parent
local closeButton = gui.InventoryBackground.Close
local tokens = gui.InventoryBackground.Tokens
local container = gui.InventoryBackground.Container
local playerData = {}
local function getTowerStatus(towerName)
if table.find(playerData.EquippedTowers,towerName) then
return "Equipped"
elseif table.find(playerData.OwnedTowers,towerName) then
return "Owned"
else
return "Not Owned"
end
end
local function updateTowers()
local newButton = container.Template:Clone()
for i, tower in pairs(towerShop) do
local status = getTowerStatus(tower.Name)
if status == "Owned" then
newButton.Name = tower.Name
newButton.TowerName.Text = tower.Name
newButton.Visible = true
newButton.Parent = container
newButton.Equipped.Visible = true
else
newButton.Status.Text = ""
end
local oldButton = container:FindFirstChild(tower.Name)
if oldButton then
oldButton:Destroy()
end

invalid argument #1 to ‘find’ (table expected, got nil) – error here
im not sure what to do lol