Hi. I've created an automated minigames script, which has a few problems. The players respawn in some random place the first time, then die, then spawn at the right place, which is bad, since I want them to be spawned at a spawn location first time round. Also, the timer doesn't work. Also, another glitch is that sometimes, the player repeatedly spawns outside the map.
Thank you. The output doesn't say anything but this "Players.Player1.PlayerGui.timer.Frame.timetext.Script:42: attempt to index field 'Parent' (a nil value)"
function respawn()
for i, v in pairs(game.Players:GetPlayers()) do
coroutine.resume(coroutine.create(function()
v:LoadCharacter()
end))
end
end
function timer()
respawn()
if game.Workspace.MapHolder:GetChildren()[1]~= nil then
for i = timelim, 0, -1 do
wait(1)
script.Parent.Text = i -- this line
end
script.Parent.Text = "Time up!"
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)
if game.Players.NumPlayers>=reqplr then
wait(3)
randommap()
end
end
end
end
end

5 comments
Use the output or your general knowledge to isolate your problem. Dumping a huge amount of code isn't a good way of asking for help.
Ok, I've shortened it.
Your error is outside of the code that you've provided.
This line is apparently the problem : script.Parent.Text = ""..i
Put the whole script so that we can see what line 42 is