Error with tables

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

image

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

Change that to this:

local function getTowerStatus(towerName)
    if playerData["EquippedTowers"] == nil or playerData["OwnedTowers"] == nil then return warn("One of the playerData tables are empty") end
	if table.find(playerData.EquippedTowers,towerName) then
		return "Equipped"
	elseif table.find(playerData.OwnedTowers,towerName) then
		return "Owned"
	else
		return "Not Owned"
	end
end

i actually forgot to invokeserver from one of my remote functions thank you for trying to help tho