Like i said, I added prints in the module. Its right in the first line, so no infinite loop should happen.
local plot = {}
plot.Random = Random.new()
local x = {}
local y = 200
local z = 300
local FIRST_OFFSET = 200
local function fillTable()
for i=FIRST_OFFSET, 10000, 100 do
wait()
if not table.find(x, i) then
table.insert(x, i)
end
end
end
fillTable()
function plot.new(player:Player)
print("Called")
local num = 1
local chosen = x[num]
table.remove(x, 1)
local part = Instance.new("Part", game.ReplicatedStorage.Plots)
part.Anchored = true
part.Size = Vector3.new(50, 1, 50)
part.TopSurface = Enum.SurfaceType.SmoothNoOutlines
part.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
part.Position = Vector3.new(chosen, y, z)
local tag = Instance.new("IntValue", part)
tag.Name = "Position"
tag.Value = chosen
local plrValue = Instance.new("StringValue", part)
plrValue.Name = "Player"
plrValue.Value = player and player.Name or "LOL"
end
return plot
That fill table function with the wait is going to take minutes. You’re doing a lot there. The player added code won’t work until that’s done. [oops. Didn’t notice you were incrementing by hundreds. Not minutes,]
You can remove that wait. It’s a small enough loop you’re just adding delay unnecessarily (unless for some reason you need to specifically control the timing). My initial estimate was off because I didn’t notice the amount you were incrementing by. But any waits before your player added code can make it miss you while testing.