Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Script Error : Expected 'end' got <eof>; did you forget to close 'then' at line 153?

Asked by 12 days ago
Edited 12 days ago

While I was writing my code it seemed to be fine but when i tested in on output there is and error message and it said : ServerScriptService.ServerMain:172: Expected 'end' (to close 'do' at line 75), got <eof>; did you forget to close 'then' at line 153? And None Of The Script Worked Anymore And i Don't Know How To Fix It And If Anyone Can i Would Heavily Appreciate it! Here Is The Code :

-- Services
local replicatedStorage = game:GetService("ReplicatedStorage")
local serverStorage = game:GetService("ServerStorage")

local status = replicatedStorage.Values.Status

local timer = replicatedStorage.Values.Timer

local playersLeft = replicatedStorage.Values.PlayersLeft

local hitbox = serverStorage:WaitForChild("Hitbox")
-- Config
local playersToStart = 1

local contestants = {}

-- Functions

local function chooseSeeker(availablePlayers)
    return availablePlayers[math.random(1,#availablePlayers)]
end

local function teleportPlayers(availablePlayers,spawns)
    for _, plr in pairs (availablePlayers) do
        if plr.Character then
            if plr.Character:FindFirstChild("HumanoidRootPart")then
                plr.Character.HumanoidRootPart.CFrame = spawns[math.random(1,#spawns)].CFrame + Vector3.new(0,5,0)
            end
        end
    end
end

local function toMS(s)
    return ("i:i"):format(s/60%60, s%60)
end

local function addHitbox(player)

    if player then
        if player.Character then
            local character = player.Character
            local hitboxClone = hitbox:Clone()
            hitboxClone.CFrame = character.HumanoidRootPart.CFrame
            local weld = Instance.new("Weld")
            weld.Part1 = character.HumanoidRootPart
            weld.Part0 = hitboxClone
            weld.Parent = hitboxClone
            hitboxClone.Parent = character
            print("Hitbox Added For "..player.Name)
        end
    end
end

wait(5)

local function isContestant(plr)
    for _, contestant in pairs(contestants) do
        if  contestant == plr then
            return true
        end
    end

    return false
end

local function kickOutContestant(plr)
    for i, contestant in pairs(contestants) do
        if  contestant == plr then
            table.remove(contestants,i)
            print("Booted "..contestant.Name.." From The Game")
        end
    end
end

while wait(1) do
    contestants = {}

    repeat

        print("Not Enough Players In-Game")
        status.Value = playersToStart.." Players Needed To Start ("..#game.Players:GetPlayers().."/"..playersToStart..")"

        wait(1)

    until #game.Players:GetPlayers() >= playersToStart

    for i = 10,0,-1 do
        status.Value = "Next Round Starts In "..i.." Seconds"
        wait(1)
    end

    contestants = game.Players:GetPlayers()

    local seeker = chooseSeeker(contestants)

    status.Value = "The Seeker Is... "
    wait(5)
    status.Value = seeker.Name.."!"

    wait(4)

    local map = game.Workspace.TempMap

    kickOutContestant(seeker)

    teleportPlayers(contestants,map.Spawns:GetChildren())

    local hitbox = addHitbox(seeker)
    -- Disconnect Me
    seekerHitboxConnection = hitbox.Touched:Connect(function(hit)
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if player then
            print(player.Name)
            if isContestant(player) then
                print("Real contestent")
                kickOutContestant(player)
                status.Value = player.Name.." Was Killed By The Seeker!"
                if player.Character then
                    player.Character.Head:Destroy()
                end
                print("Kicked")
            end
        end
    end)

    status.Value = "Get Ready To Hide!"

    wait(5)

    for i = 60,0,-1 do
        status.Value = "Go Hide!"
        timer.Value = toMS(i)
        playersLeft.Value = #contestants
        wait(1)
    end

    teleportPlayers({seeker},map.SeekerSpawns:GetChildren())

    status.Value = "The Seeker Has Been Released"

    if seeker.Character then
        seeker.Character.Humanoid.Walkspeed = 55.5

    wait(3)

    local outcome = nil

    for i = 270,0,-1 do
        status.Value = "Game In Progress"
        timer.Value = toMS(i)
        playersLeft.Value = #contestants

        if #contestants == 00 then
            outcome = "The Seeker Has Won!"
            break
        end

        wait(1)
    end

    if outcome == "SeekerWon" then
        status.Value = "The Seeker Wins!"
    else
        status.Value = "Times Up! Contestants Win!"
    end

    status.Value = "End Of Round!"

    if seekerHitboxConnection then seekerHitboxConnection:Disconnect() print("Successfully Disconnected") end

    wait(2)
end

Thanks!

NOTICE : I Got This Script From AlvinBlox Hide & Seek Tutorial And I've Got Up To Part 2

1 answer

Log in to vote
0
Answered by
Pupppy44 471 Moderation Voter
12 days ago

I believe you're missing an end for the while true do loop.

0
Which Line? rjthecoolkid1215 4 — 11d
Ad

Answer this question