#im confused [SOLVED]
1 messages · Page 1 of 1 (latest)
--SERVICES
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local Role = ReplicatedStorage.Role
--MODULES
local MafiaGame = require(ReplicatedStorage.MafiaGame)
--local Villager = require(Role.Villager)
--local Mafia = require(Role.Mafia)
local Player = require(ReplicatedStorage.Player)
--REMOTES
--local GameStart = ReplicatedStorage.Core.Remotes:WaitForChild("GameStart")
local Round = require(ServerScriptService.Round)
local newRound = Round.new()
local currentGame = nil
local queuedPlayers = {}
--if not game:IsLoaded() then
-- game.Loaded:Wait()
--end
function Main()
while not newRound.inRound do
task.wait()
end
currentGame = MafiaGame.new(queuedPlayers)
currentGame.Start()
end
Players.PlayerAdded:Connect(function(p)
print("connected function is running")
table.insert(queuedPlayers, Player.new(p.DisplayName, p.UserId))
if newRound.Status == "Intermission" then return end
if not newRound.inRound then
newRound:Init()
end
end)
Players.PlayerRemoving:Connect(function(p)
if not newRound.inRound then
for _,v in queuedPlayers do
if v.userID == p.UserId then
table.remove(queuedPlayers, v)
print("removed" .. p.DisplayName .. "from queue")
end
end
else
--TODO: handle player leaving during round (make em dead ingame, add penalty later)
end
end)
Main()
whats suppose to be the question
was editing the thingy, accidentally put this big ass code block in the title ._.
** You are now Level 6! **
it feels like table.insert is just not operating how i want it to
that or im fucking something major up somewhere
assert(type({}) == table, ...) is guaranteed to always throw an error which halts the code after it
the type and typeof functions return a string. always watch your output window, and look up things in the docs even if they are seemingly trivial as the type() or assert() functions
ah okay
is there an alternative to ensure that a table is getting passed
thank 
yesssss
