Code:
local CS = game:GetService("CollectionService")
local Config = {
MaxPlayers = 1;
NumOfRounds = 8;
}
local PlayingPlrs = {}
local Enterance = script.Parent:WaitForChild("Enterance")
Enterance.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if #PlayingPlrs < Config.MaxPlayers then
table.insert(PlayingPlrs, hit.Parent.Name)
if #PlayingPlrs == Config.MaxPlayers then
task.wait(0.5)
Enterance.CanCollide = true
end
end
end
end)
local QueueLabel = Enterance.QueueUI.Label
local Colors = {
["Red"] = Color3.fromRGB(255, 0, 0);
["Orange"] = Color3.fromRGB(255, 102, 0);
["Yellow"] = Color3.fromRGB(255, 255, 0);
["Green"] = Color3.fromRGB(77, 255, 64);
["Cyan"] = Color3.fromRGB(76, 240, 255);
["Blue"] = Color3.fromRGB(0, 150, 225);
["Pink"] = Color3.fromRGB(255, 170, 255);
["Magenta"] = Color3.fromRGB(255, 0, 255);
["Purple"] = Color3.fromRGB(153, 76, 229);
}
local Board = script.Parent:WaitForChild("Board"):WaitForChild("SurfaceGui")
local ColorDisplay = script.Parent:WaitForChild("ColorDisplay")
local Plates = script.Parent:WaitForChild("Plates"):GetChildren()
while true do
repeat
QueueLabel.Text = "QUEUE: " .. tostring(#PlayingPlrs) .. "/" .. tostring(Config.MaxPlayers)
task.wait(1)
until #PlayingPlrs == Config.MaxPlayers
for round = 1,Config.NumOfRounds do
local AvailableColors = {"Red", "Orange", "Yellow", "Green", "Cyan", "Blue", "Pink", "Magenta", "Purple"}
Board.RoundNum.Text = round .. "/" .. Config.NumOfRounds
local CorrectColor = AvailableColors[math.random(1,#AvailableColors)]
print(CorrectColor)
local CorrectPlate = Plates[math.random(1,#Plates)]
print(CorrectPlate)
CorrectPlate.Correct.Value = true
CorrectPlate.Color = Colors[CorrectColor]
table.remove(AvailableColors, table.find(AvailableColors, CorrectColor))
for _, Plate in pairs(CS:GetTagged("Plate")) do
if Plate.Correct.Value == false then
local ChosenFakeColor = AvailableColors[math.random(1,#AvailableColors)]
Plate.Color = Colors[ChosenFakeColor]
table.remove(AvailableColors, table.find(AvailableColors, ChosenFakeColor))
end
end
if math.clamp(round,1,3) == round then
for secs = 5,0,-1 do
Board.Countdown.Text = "⌛" .. secs .. "s"
task.wait(1)
end
elseif math.clamp(round,4,6) == round then
for secs = 3,0,-1 do
Board.Countdown.Text = "⌛" .. secs .. "s"
task.wait(1)
end
elseif math.clamp(round,6,8) == round then
for secs = 2,0,-1 do
Board.Countdown.Text = "⌛" .. secs .. "s"
task.wait(1)
end
end
for _, Plate in pairs(CS:GetTagged("Plate")) do
if Plate.Correct.Value == false then
Plate.CanCollide = false
end
end
task.wait(3.5)
for _, Plate in pairs(CS:GetTagged("Plate")) do
Plate.CanCollide = true
end
end
task.wait(1)
end
I am creating a color game which you have to stand on the correct plate color in order to win but the correct plate has a different color and some colors appear twice