我的脚本因为EOF而出现问题

问题描述 投票:0回答:1

我知道我的代码去开发四m,但我想在这里问.这是我的代码。

-- define varibles

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ServerStorage = game:GetService("ServerStorage")

local MapsFolder = ServerStorage:WaitForChild("Maps")

local Status = ReplicatedStorage:WaitForChild("Status")

local GameLenght = 60

local player = {}

local Seeker = game.Teams.Seeker

local Hider = game.Teams.Hider

local Lobby = game.Teams.Lobby

local team = game.Teams

local reward = 25
-- game loop
while true do

    Status.Value = "Wating for two players"

    repeat wait(1) until game.Players.NumPlayers >= 2

    Status.Value = "Intermission"
    plrs.team = Lobby

    wait(10)

    local plrs = {}

    for i, player in pairs(game.Players:GetPlayers()) do 
        if player then
            table.insert(plrs,player) --- add each player
        end
    end

    wait(2)

    local AvailableMaps = MapsFolder:GetChildren()

    local ChosenMap = AvailableMaps[math.random(1,#AvailableMaps)]

    Status.Value = "Map "..ChosenMap.Name.. " chosen."
    wait(5)
    local ClonedMap = ChosenMap:Clone()
    ClonedMap.Parent = workspace

    --- teleport players to map

    local SpawnPoints = ClonedMap:FindFirstChild("SpawnPoints")

    if not SpawnPoints then
        print ("spawn points nout found OOF")
    end

    local AvailableSpawnPoints = SpawnPoints:GetChildren()

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

            if character then
                -- teleport them

                character:FindFirstChild("HumanoidRootPart").CFrame = AvailableSpawnPoints[1].CFrame + Vector3.new(0,10,0)
                table.remove(AvailableSpawnPoints,1)


                -- give sword
                math.random(player,Seeker)
                local Seeker = 1
                local Hider = (2 - #player)
                if Seeker then
                    local Sword = ServerStorage.Sword:Clone()
                Sword.Parent = player.Backpack

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

                end
            else
                print("not a seeker")
            end 

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


    Status.Value = "Get ready to play!"

    wait(2)

    for i = GameLenght,0,-1 do

        for x, player in pairs(plrs) do
            if player then

                character = player.Character

                if not character then
                    -- left game
                    table.remove(plrs,x)
                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)
                print(player.Name " has been removed")
            end
        end

        Status.Value = "There are "..i.." seconds remaing and "..#plrs.." players to find"

        if #plrs == 1 then
            -- last player
            Status.Value = " The winner is "..Hider[1].Name
            wait(6)
            Seeker[1].leaderstats.Bucks.Value = Seeker[1].leaderstats.Bucks.Value  + reward
            break
        elseif #plrs == 0 then
            Status.Value = "Nobody won!"
            wait(5)
            break
        elseif i == 0 then
            Status.Value = "Times up! Hiders win!"
            Hider[1].leaderstats.Bucks.Value = Hider[1].leaderstats.Bucks.Value  + reward
            wait(5)
            break
        end

        wait(1)
    end

    print("end of game")
    for i, player in pairs(game.Players:GetPlayers()) do
    character = player.Character


    if not character then
        -- ignore them
    else
        if character:FindFirstChild("GameTag") then
            character.GameTag:Destroy()
        end

        if player.Backpack:FindFirstChild("Sword") then
            player.Backpack.Sword:Destroy()
        end

        if character:FindFirstChild("Sword") then
            character.Sword:Destroy()
        end

    end

    player:LoadCharacter()
    player.team = Lobby
end

    ClonedMap:Destroy()

    Status.Value = "Game ended"

    wait(2)
 end

在这段文字上面我的代码说除了 "EOF "得到结束。如果有人能告诉我,我的问题是什么,这将是真棒!我知道我的代码去开发四m,但我想在这里问。

lua roblox
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.