im making a table system, and when a remote event is fired, it assigns people to a table based on the value passed in the remote event. While I’m making this, my oop code is running for all of the tables instead of just one of them. How can I change this?
code:
local class = require(game.ServerStorage.Modules.Classic)
local Table = class:extend()
function Table:new(tableFolder, Tables)
self.people = {}
self.signLabel = tableFolder.Sign.Text.BillboardGui.TextLabel
self.Tables = Tables
--if not staff dont show
game.Players.PlayerAdded:Connect(function(player)
if player.Name ~= "lxgh1lxy" then
tableFolder.Sign.Text.BillboardGui.Enabled = false
end
end)
--ontouch claim
game.ReplicatedStorage.Tablets.OnServerEvent:Connect(function(player, order, num, tableSit)
for i = 1, #order do
table.insert(self.people, order[i])
end
end)
--onleave
game.Players.PlayerRemoving:Connect(function(player)
end)
end
function Table:update()
if #self.people == 0 then
self.signLabel.Text = "Vacant"
elseif #self.people >= 1 then
self.signLabel.Text = "Taken"
end
end
function Table:owns(player)
for index, Table in pairs(self.Tables) do
if Table.owner == player then
return true
end
end
return false
end
return Table
thanks