Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

This script isn't working, and nothing is in the output. I'd like a solution please?

Here's the script it's not working AT ALL, like nothing in the output, or anything. I'd like help on how to fix it? Problems? Could someone please help me out here???


repeat wait(0)until game:FindFirstChild("Teams")

local NumPlayers = 2 --Change this to the number of players needed

local A = game.Players

local A1 = "This service is unavailable, please wait until 1 more player joins..."

local A2 = "Welcome to the official meadows sfing game"

local A4 = "5"

local A3 = "The amount of players is successful, and the game will be starting in" .. A4 .. "Seconds.."

local A5 = "Teaming players..."

local A6 = "Blue team has won"

local A7 = "Red team has won"

local BlueTeam = game.Teams:WaitForChild("BlueTeam")

local RedTeam = game.Teams:WaitForChild("BlueTeam")

local redplayers = 0

local blueplayers = 0

local M = Instance.new("Message")

local TimeForLoop = .5 --This will loop the script every .5 seconds

local players = 0

local GameRun = false

 

function fixTeams()

BlueTeam:Clone().Parent = game.Teams -- Whats 'clones[1]'?

RedTeam:Clone().Parent = game.Teams -- Whats 'clones[2]'?

end

 

function checkSpectators()

spectators = 0

for _, player in pairs(game.Players:GetChildren()) do

if player.TeamColor == game.Teams.Spectators.TeamColor then

spectators = spectators + 1

if(spectators >= NumPlayers) then

BlueTeam:Destroy()

RedTeam:Destroy()

wait(3)

end

end

end

end

 

function findwinner()

for _, player in pairs(game.Players:GetPlayers()) do

if player.TeamColor == BlueTeam.TeamColor then

players = blueplayers + 1

wait(5)

if blueplayers == 0 then

print("Blue team has lost")

M.Text = A7

elseif player.TeamColor == RedTeam.TeamColor then

players = redplayers + 1

if redplayers == 0 then

print("Red team has lost")

M.Text = A6

end

end

end

end

end

 

function StartGame()

if GameRun then

fixteams()

checkspectators()

findwinner()

end

end

 

while wait(TimeForLoop)do

if A.NumPlayers >= NumPlayers then

GameRun = true

StartGame()

else

GameRun = false

print("There's not enough players in the game for the game to start.")
Wait(1)
M.Text = A1
repeat wait(0)until A.NumPlayers >= NumPlayers

end

end




1 answer

✓ Accepted answer

I tl;dr'd but, the variable RedTeam is set to the blue team so that could be your error. (It should be).

2 comments

0

If that's correct how would I fix it?

0

If my posts help please upvote because I would like to get more permissions. Change line 23 to local RedTeam = game.Teams:WaitForChild("RedTeam")

This discussion is preserved as it was. New answers, comments, and votes are closed.