I need help with my script

I get this error

Captura de pantalla 2023-10-03 134737

This script is supposed to check if someone is in the game or not.

	while true do
		
		for i = timeLeft, 1, -1 do
			visibleFrame.Value = true
			game:GetService("RunService").Heartbeat:Wait()		
			local timeLeft = config.RoundTime - math.round((tick() - gameStart))
			local mins = math.floor(timeLeft / 60)
			local secs = timeLeft - (mins * 60)
			if string.len(secs) < 2 then
				secs = "0" .. tostring(secs)
			end
			timer.Value = mins .. ":" .. secs
						
			pcall(function()
				for i = #playerstable, 1, -1 do
					if playerstable[1].Character then
						if playerstable[i].Character:FindFirstChild("ConfirmerPlaying") then
						else
							table.remove(playerstable, i)
						end
					else
						table.remove(playerstable, i)
					end
				end 
			end)
			task.wait(1)
		end
		
		wait()
		
		if #playerstable == 1 then
			intermission.Value = "Winner is: "..playerstable[1].Name
			wait(7)
			pcall(function()
				playerstable[1].Character.HumanoidRootPart.Position = game.Workspace.Lobby.SpawnPoint.Position
			end)
			break
		end
		
		if #playerstable == 0 then
			intermission.Value = "No winners "
			wait(3)
			break
		end
		
	end
1 Like

which line is 107 because the error is related to this line

that is line 107

The truth is that I don’t know much about scripts so I don’t know what I did to get the error.

Can you print out what playerstable is?

exactly this is the error

if #playerstable == 1 then
			intermission.Value = "Winner is: "..playerstable[1].Name
			wait(7)
			pcall(function()
				playerstable[1].Character.HumanoidRootPart.Position = game.Workspace.Lobby.SpawnPoint.Position
			end)
			break
		end

It says it doesn’t work because of the .Name

What is intermission? Is it a NumberValue, an IntValue, or text? It looks like it’s trying to get a number Value and you are assigning a text format.

			intermission.Value = "Winner is: "..playerstable[1].Name

you haven’t the variable “intermission” created.
it might be the problem of giving string: "Winner is: " and then you give a number.
you might create two variables one for the number other for the phrase

To understand what error there is in your code, do print("intermission.Value = "Winner is: “…playerstable[1]”) and see what it outputs. Maybe you do not need to write .Name

I just realized it was an IntValue

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.