Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Interfering functions?

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

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

1 comment

0

The script stays in the textlabel.

This discussion is preserved as it was. New answers, comments, and votes are closed.