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

Im confused? with this script says error Expected 'end' (to close 'then' at line 35), got <eof>

Asked by 4 years ago
Edited by royaltoe 4 years ago

I am a beginner and dont know how to script im starting and i was following a youtube channel help please

-- Define variables    --Made by munder12e--

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local MapsFolder = ServerStorage:WaitForChild("Maps")
local Status = ReplicatedStorage:WaitForChild("Status")
local GameLength = 50

while true do
    Status.Value = "Waiting for enough players"
    repeat wait() until game.Players.NumPlayers >= 2
    Status.Value = "Intermission"

    wait(10)

    plrs = {}
    for i, player in pairs(game.Players:GetPlayers()) do
        if player then
            table.insert(plrs,player)
        end
    end

    wait(2)
end

local AvailableMaps = MapsFolder:GetChildren()
local ChosenMap = AvailableMaps[math.random(1,#AvailableMaps)]
Status.Value = ChosenMap.Name.." Chosen"
local ClonedMap = ChosenMap:Clone()

ClonedMap.Parent = workspace

-- Teleport players to the map
local SpawnPoints = ClonedMap:FindFirstChild ("SpawnPoints")
if not SpawnPoints then
    print("Spawnpoint not found")
    local AvailableSpawnPoints = SpawnPoints:GetChildren ()

    for i, player in pairs (plrs)do
        if player then
            character = player.Character

            if character then
            -- Teleport them

            character:FinsFirstChild ("HumanoidRootPart").CFrame = AvailableSpawnPoints[1].Cframe
            table.remove(AvailableSpawnPoints,1)


            -- Give them a sword

            local ClassicSword = ServerStorage.ClassisSword:clone ()
            ClassicSword.Parent = player.Backpack

            local Handgun = ServerStorage.Handgun:clone ()
            Handgun.Parent = player.Backpack

            local GameTag = Instance.new("BoolValue")
            Gametag.Name = "GameTag"
            Gametag.Parent = player.Charatcer

        else
            -- There is no character
            if not player then
                table.remove(plrs,i)



            end

            end

        end
    end

    Status.Value = "Starting in 5"

    wait(1)

    Status.Value = "Starting in 4"

    wait (1)

    Status.Value = "Starting in 3"

    wait (1)

    Status.Value = "Starting in 2"

    wait(1)

    Status.Value = "Starting in 5"

    wait (1)

    for i = GameLength,0, -1 do 
        for x, player in pairs(plrs)do
            if player then

            character = player.Character

            if not character then
                -- Left The game
            else
                if character:FindFirstChild("GameTag") then
                    -- They are still alive
                    print(Player.Name.."is still in the game!")
                else
                    -- They are dead
                    table.remove(plrs,x)    
                end

            end
        else
            table.remove(plrs,x)    
        end
    end

    wait(1)

end

1 answer

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

EOF stands for End of File. Each scope that gets created is required to be closed, in other languages it can be determined by different syntax, however Lua defines a closed scope via the end keyword.

At line 43 you didn’t close the scope respectfully, also left an open end in an improper scope too, at 71.

Fixed program.


- Define variables --Made by munder12e-- local ReplicatedStorage = game:GetService("ReplicatedStorage") local ServerStorage = game:GetService("ServerStorage") local MapsFolder = ServerStorage:WaitForChild("Maps") local Status = ReplicatedStorage:WaitForChild("Status") local GameLength = 50 while true do Status.Value = "Waiting for enough players" repeat wait() until game.Players.NumPlayers >= 2 Status.Value = "Intermission" wait(10) plrs = {} for i, player in pairs(game.Players:GetPlayers()) do if player then table.insert(plrs,player) end end wait(2) end local AvailableMaps = MapsFolder:GetChildren() local ChosenMap = AvailableMaps[math.random(1,#AvailableMaps)] Status.Value = ChosenMap.Name.." Chosen" local ClonedMap = ChosenMap:Clone() ClonedMap.Parent = workspace -- Teleport players to the map local SpawnPoints = ClonedMap:FindFirstChild ("SpawnPoints") if not SpawnPoints then print("Spawnpoint not found") local AvailableSpawnPoints = SpawnPoints:GetChildren () for i, player in pairs (plrs)do if player then character = player.Character if character then -- Teleport them character:FinsFirstChild ("HumanoidRootPart").CFrame = AvailableSpawnPoints[1].Cframe table.remove(AvailableSpawnPoints,1) -- Give them a sword local ClassicSword = ServerStorage.ClassisSword:clone () ClassicSword.Parent = player.Backpack local Handgun = ServerStorage.Handgun:clone () Handgun.Parent = player.Backpack local GameTag = Instance.new("BoolValue") Gametag.Name = "GameTag" Gametag.Parent = player.Charatcer end else -- There is no character if not player then table.remove(plrs,i) end end end Status.Value = "Starting in 5" wait(1) Status.Value = "Starting in 4" wait (1) Status.Value = "Starting in 3" wait (1) Status.Value = "Starting in 2" wait(1) Status.Value = "Starting in 5" wait (1) for i = GameLength,0, -1 do for x, player in pairs(plrs)do if player then character = player.Character if not character then -- Left The game else if character:FindFirstChild("GameTag") then -- They are still alive print(Player.Name.."is still in the game!") else -- They are dead table.remove(plrs,x) end end else table.remove(plrs,x) end end wait(1) end

Please do not follow YouTube tutorials unless they’re explaining or demonstrating a subject. Most programs are highly inefficient or buggy. Please try to do 80% of the work on your own.

Ad

Answer this question