local function CalculatePlayers()
local NumberOfPlayers = #game.Players:GetPlayers()
return NumberOfPlayers
end
while wait() do
if CalculatePlayers() >= Settings.PlayersNeeded then
for i, v in pairs(Folder:GetChildren()) do
if v then
v:Destroy()
end
end
local PlayersInGame = {}
-- where the game starts
for i = Settings.Intermission, 1, -1 do
Status.Value = "intermission - "..i
end
Status.Value = "The Round is ready to begin!"
Settings.RoundInProgress.Value = true
wait(5)
local Plates = Assets.Plates:Clone()
Plates.Parent = game.Workspace.Folder
for keyvalue, player in pairs(game.Players:GetPlayers()) do
if player.Character:FindFirstChild("Humanoid") then
if player.Character.Humanoid.Health >=1 then
table.insert(PlayersInGame, keyvalue, player)
player.Team = game.Teams.Survivors
for i, v in pairs(Plates:GetChildren()) do
if v.Settings.OwnerOfPlate.Value == "None" and not player.Character:FindFirstChild("PlateValue") then
v.Settings.OwnerOfPlate.Value = player.Name
player.Character.HumanoidRootPart.CFrame = v.CFrame * CFrame.new(0, 2, 0)
local PlateValue = Instance.new("ObjectValue")
PlateValue.Parent = player.Character
PlateValue.Value = v
PlateValue.Name = "PlateValue"
end
end
end
end
end
for i, v in pairs(Plates:GetChildren()) do
if v.Settings.OwnerOfPlate.Value == "None" then
v:Destroy()
end
end
wait(5)
repeat
for i = Settings.TimeBetweenEvents, 1, -1 do
Status.Value = "Next Event is in "..i.. " seconds!"
wait(1)
end
if #PlayersInGame >= 1 then
local Value = math.random(1, #PlayersInGame)
local RandomPlayer = PlayersInGame
print(RandomPlayer.Name)
else
for i, v in pairs(PlayersInGame) do
table.remove(PlayersInGame, 1)
end
end
until Settings.RoundInProgress.Value == false
else
-- not enough players
Status.Value = "At least two players are needed to anger the gods!"
end
local Status = GameData.Status
local Settings = {
Intermission = 10,
PlayersNeeded = 1,
TimeBetweenEvents = 5,
RoundInProgress = GameData.RoundInProgress.Value
--[[
RoundInProgress = GameData.RoundInProgress.Value <-- error here because you are trying
to set a value as RoundInProgress and it is NOT defined as an object.
]]
}
-- So instead do this:
Settings.RoundInProgress == false
Just to make it easy the code should look like this:
local GameData = game.ReplicatedStorage.GameData
local Assets = game.ServerStorage.Assets
local Folder = game.Workspace.Folder
local Status = GameData.Status
local Settings = {
Intermission = 10,
PlayersNeeded = 1,
TimeBetweenEvents = 5,
RoundInProgress = GameData.RoundInProgress.Value
}
local function CalculatePlayers()
local NumberOfPlayers = #game.Players:GetPlayers()
return NumberOfPlayers
end
while wait() do
if CalculatePlayers() >= Settings.PlayersNeeded then
for i, v in pairs(Folder:GetChildren()) do
if v then
v:Destroy()
end
end
local PlayersInGame = {}
-- where the game starts
for i = Settings.Intermission, 1, -1 do
Status.Value = "intermission - "..i
end
Status.Value = "The Round is ready to begin!"
Settings.RoundInProgress = true
wait(5)
local Plates = Assets.Plates:Clone()
Plates.Parent = game.Workspace.Folder
for keyvalue, player in pairs(game.Players:GetPlayers()) do
if player.Character:FindFirstChild("Humanoid") then
if player.Character.Humanoid.Health >=1 then
table.insert(PlayersInGame, keyvalue, player)
player.Team = game.Teams.Survivors
for i, v in pairs(Plates:GetChildren()) do
if v.Settings.OwnerOfPlate.Value == "None" and not player.Character:FindFirstChild("PlateValue") then
v.Settings.OwnerOfPlate.Value = player.Name
player.Character.HumanoidRootPart.CFrame = v.CFrame * CFrame.new(0, 2, 0)
local PlateValue = Instance.new("ObjectValue")
PlateValue.Parent = player.Character
PlateValue.Value = v
PlateValue.Name = "PlateValue"
end
end
end
end
end
for i, v in pairs(Plates:GetChildren()) do
if v.Settings.OwnerOfPlate.Value == "None" then
v:Destroy()
end
end
wait(5)
repeat
for i = Settings.TimeBetweenEvents, 1, -1 do
Status.Value = "Next Event is in "..i.. " seconds!"
wait(1)
end
if #PlayersInGame >= 1 then
local Value = math.random(1, #PlayersInGame)
local RandomPlayer = PlayersInGame
print(RandomPlayer.Name)
else
for i, v in pairs(PlayersInGame) do
table.remove(PlayersInGame, 1)
end
end
until Settings.RoundInProgress == false
else
-- not enough players
Status.Value = "At least two players are needed to anger the gods!"
end