Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What should I do with this script?!

Asked by
mine248 40
8 years ago

I have created a script that changes the state of the condition. It gives me a confusing error I cannot know.

Error:

17:47:54.005 - ServerScriptService.Script:105: 'then' expected near 'while'

Error code:

local replicated = game:GetService("ReplicatedStorage")
local statustag = replicated:WaitForChild("StatusTag")
local timer = replicated:WaitForChild("Timer")
local roundtime = 60 * 2

if game.Workspace.Win.GCT1.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") and game.Workspace.Win.GCT1.Enabled.Value == true then
        game.Workspace.Win.GCT1.Enabled.Value = false
        game.Workspace.Win.TQ1.Enabled.Value = true
        if replicated.Trk3.Value == 0 and replicated.Trk4.Value == 0 then
            replicated.Trk1.Value = 1
        elseif replicated.Trk3.Value == 2 and replicated.Trk4.Value == 1 or replicated.Trk3.Value == 1 and replicated.Trk4.Value == 2 then
            replicated.Trk1.Value = 3
        elseif replicated.Trk3.Value == 1 and replicated.Trk4.Value == 0 or replicated.Trk3.Value == 0 and replicated.Trk4.Value == 1 then
            replicated.Trk1.Value = 2
        end
    elseif hit.Parent:FindFirstChild("Humanoid") and game.Workspace.Win.GCT2.Enabled.Value == true then
        game.Workspace.Win.GCT2.Enabled.Value = false
        game.Workspace.Win.TQ2.Enabled.Value = true
        if replicated.Trk1.Value == 0 and replicated.Trk4.Value == 0 then
            replicated.Trk3.Value = 1
        elseif replicated.Trk1.Value == 2 and replicated.Trk4.Value == 1 or replicated.Trk1.Value == 1 and replicated.Trk4.Value == 2 then
                replicated.Trk3.Value = 3
        elseif replicated.Trk1.Value == 1 and replicated.Trk4.Value == 0 or replicated.Trk1.Value == 0 and replicated.Trk4.Value == 1 then
            replicated.Trk4.Value = 2
        end
    elseif hit.Parent:FindFirstChild("Humanoid") and game.Workspace.Win.GCT3.Enabled.Value == true then
        game.Workspace.Win.GCT3.Enabled.Value = false
        game.Workspace.Win.TQ3.Enabled.Value = true
        if replicated.Trk1.Value == 0 and replicated.Trk3.Value == 0 then
            replicated.Trk4.Value = 1
        elseif replicated.Trk1.Value == 2 and replicated.Trk3.Value == 1 or replicated.Trk1.Value == 1 and replicated.Trk3.Value == 2 then
            replicated.Trk4.Value = 3
        elseif replicated.Trk1.Value == 1 and replicated.Trk3.Value == 0 or replicated.Trk1.Value == 0 and replicated.Trk3.Value == 1 then
            replicated.Trk4.Value = 2
        end
    end
end)

while true do
--sort out what we need for a round
    wait(5)
    contestants = {}
    blue = {}
    yellow = {}
    green = {}
    for _, player in pairs(game.Players:GetPlayers()) do
        if player and player.Character then
            local humanoid = player.Character:WaitForChild("Humanoid")
            if humanoid and humanoid.Health > 0 and player.TeamColor.Name == "Lime green" then
                table.insert(contestants, player)
                table.insert(green, player)
            elseif humanoid and humanoid.Health > 0 and player.TeamColor.Name == "New Yeller" then
                table.insert(contestants, player)
                table.insert(yellow, player)
            elseif humanoid and humanoid.Health > 0 and player.TeamColor.Name == "Really blue" then
                table.insert(contestants, player)
                table.insert(blue, player)
            end
        end
    end
    if #contestants >= 3 then
        break
    else
        statustag.Value = "Waiting for Players"
        timer.Value = -1
    end
    for _, player in pairs(contestants) do
        local matchtag = Instance.new("StringValue")
        matchtag.Name = "MatchTag"
        matchtag.Parent = player.Character
    end
    if #blue > 0 then
        local bluerep = blue[math.random(1, #blue)]
        bluerep.Character:WaitForChild("Torso").CFrame = CFrame.new(game.Workspace.R62_Trk1.Model.VehicleSeat.Position + Vector3.new(0,0,0))
    elseif #yellow > 0 then
        local yellowrep = yellow[math.random(1, #yellow)]
        yellowrep.Character:WaitForChild("Torso").CFrame = CFrame.new(game.Workspace.R62_Trk3.Model.VehicleSeat.Position + Vector3.new(0,0,0))
    elseif #green > 0 then
        local greenrep = green[math.random(1, #green)]
        greenrep.Character:WaitForChild("Torso").CFrame = CFrame.new(game.Workspace.R62_Trk4.Model.VehicleSeat.Position + Vector3.new(0,0,0))
    end
    replicated.Timer = roundtime
    replicated.StatusTag.Value = "Game!"
    wait(1)
    replicated.StatusTag.Value = "Game Time:"
    while replicated.Timer.Value > 0 do
        wait(1)
        replicated.Timer.Value = replicated.Timer.Value - 1
    end
end

What should I do??

0
This part of the script has nothing to do with the error. 1waffle1 2908 — 8y
0
Check it again? mine248 40 — 8y

Answer this question