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

Problem with my fighting script? (#2)

Asked by
Relatch 550 Moderation Voter
10 years ago
local gui = game.Workspace.Part1.v.z

function Intermission()
    for i = 15, 0, -1 do
        gui.Text = "Intermission (0:"..i..")"
        if i <= 9 then
            gui.Text = "Intermission (0:0"..i..")"
        end
        wait(1)
    end
end

function ChooseDuelers_Teleport()
    gui.Text = "Now choosing dulers, (1 and 2)."
    wait(5)

    local plrs = game.Players:GetPlayers()
    local p1 = plrs[math.random(1, #plrs)]
    local p2 = plrs[math.random(1, #plrs)]

    repeat local p2 = plrs[math.random(1, #plrs)]
    until p2 ~= p1

    gui.Text = p1.Name.. " and " ..p2.Name.. " have been chosen."

    plrs[p1].Character:MoveTo(Vector3.new(147.5, 11.6, 15)) 
    plrs[p2].Character:MoveTo(Vector3.new(147.5, 11.6, -59))
    wait(5)
end

function Round()
    for i = 30, 0, -1 do
        gui.Text = "Round, please wait (0:"..i..")"
        if i <= 9 then
            gui.Text = "Round, please wait (0:0"..i..")"
        end
        wait(1)
    end
end

while true do
    if game.Players.NumPlayers > 1 then
        Intermission()
        ChooseDuelers_Teleport()
        Round()
    elseif game.Players.NumPlayers == 1 then
        gui.Text = "Waiting for 2 or more players."
    end
    wait()
end

Error: 16:57:19.327 - ServerScriptService.Script:26: attempt to index field '?' (a nil value) 16:57:19.328 - Stack Begin 16:57:19.329 - Script 'ServerScriptService.Script', Line 26 - global ChooseDuelers_Teleport 16:57:19.329 - Script 'ServerScriptService.Script', Line 44 16:57:19.329 - Stack End

0
Why didn't you just edit the other question? Mystdar 352 — 10y

Answer this question