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

Hello, can I ask for help on this script? It's not running at all....

I'm sorry for the constant asking, but this script is so close to being done. It's literally right there.... But the problem is it wont even run, so there has to be atleast 1 problem.... Here's the script, I hope someone can help me out by telling me the error in the script, and maybe fixing it?

--I edited as best I could, but I could not understand most of the coding/what you were trying to do, so I edited what I thought you were trying to do

 

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.")

repeat wait(0)until A.NumPlayers >= NumPlayers

end

end




2 comments

0

What's the error? Is the script disabled?

0

Nope, I just checked.

1 answer

You made redteam = blueteam or whatever. I just posted that on your other one...

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