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

Interfering functions?

Asked by 10 years ago

Hello. I've created a timer, but when I put the respawn function in, it breaks the timer. Without the respawn function, it works fine! Also, the respawn function is faulty and spawns players in random places even though the teamcolours and spawn teamcolours match.

Help please? OUTPUT: attempt to index field 'Parent' (a nil value) at the line script.Parent.Text = time.

function respawn()
    for k, v in pairs(game.Players:GetPlayers()) do
            v:LoadCharacter()
            wait()
        end
end

function timer()
    coroutine.resume(coroutine.create(respawn))
if game.Workspace.MapHolder:GetChildren()[1]~= nil then
        local time = timelim
      for i = 1, time do
      time = time - 1
      wait(1)
    script.Parent.Text = time
        if time == 0 then
                script.Parent.Text = "Time up!"
                wait(2)
                for i,v in pairs(game.Players:GetPlayers()) do
                    if v.TeamColor ~= BrickColor.new("Bright yellow") then
                        v.TeamColor = BrickColor.new("Bright yellow")
                        v:LoadCharacter()
                        wait(5)
                        Workspace.MapHolder:ClearAllChildren()
                        if game.Players.NumPlayers>=reqplr then
                            wait(3)
                            Start()
                end
        end
        end
    end
end
end
end
end
end

1 answer

Log in to vote
2
Answered by 10 years ago

It could mean that the script's parent is nil.

0
The script stays in the textlabel. truefire2 75 — 10y
Ad

Answer this question