I keep having the following error pop up:
20:08:48.348 - Workspace.TimerSystem.FinishWall.Script:142: attempt to index local 'player' (a nil value)
Here is my script
-- Initialization
local TimerSystem = script.Parent.Parent
local Board = TimerSystem:WaitForChild("Board")
local SurfaceGui = Board:WaitForChild("SurfaceGui")
local Clock = SurfaceGui:WaitForChild("TextLabel")
-- Local Variables
local FinishWall = script.Parent
local FinishedFolder = FinishWall:WaitForChild("FinishedFolder")
local Leaderboard = TimerSystem:WaitForChild("Leaderboard")
local Space = Leaderboard:WaitForChild("Space")
local Place = Leaderboard:WaitForChild("Place")
local LeaderboardGui = Leaderboard:WaitForChild("SurfaceGui")
local Frame = LeaderboardGui:WaitForChild("Frame")
-- Checkpoint Variables
local CheckpointsFolder = TimerSystem:WaitForChild("CheckpointsFolder")
local Checkpoint1 = CheckpointsFolder:WaitForChild("Checkpoint1")
local Checkpoint2 = CheckpointsFolder:WaitForChild("Checkpoint2")
local Checkpoint3 = CheckpointsFolder:WaitForChild("Checkpoint3")
local Checkpoint4 = CheckpointsFolder:WaitForChild("Checkpoint4")
-- Event Variables
local Bools = TimerSystem:WaitForChild("Bools")
local InProgress = Bools:WaitForChild("InProgress")
local Event100m = Bools:WaitForChild("Event100m")
local Event200m = Bools:WaitForChild("Event200m")
local Event400m = Bools:WaitForChild("Event400m")
local Event800m = Bools:WaitForChild("Event800m")
local Event1600m = Bools:WaitForChild("Event1600m")
-- Functions
FinishWall.Touched:connect(function(hit)
if InProgress.Value == true then
if Event100m.Value == true or Event200m.Value == true then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local debounce = FinishedFolder:FindFirstChild(player.Name)
if player.Character and (not debounce) then
local check = Checkpoint1.Container:FindFirstChild(player.Name)
if check then
local finishtag = Instance.new("StringValue")
finishtag.Name = player.Name
finishtag.Value = player.Name
finishtag.Parent = FinishedFolder
local Placing = Instance.new("TextLabel")
Placing.Text = (Place.Value .. ") " .. player.Name .. " - " .. Clock.Text)
Placing.Size = UDim2.new(1, 0, 0.125, 0)
Placing.Position = UDim2.new(0, 0, Space.Value, 0)
Placing.TextColor3 = Color3.new(85/255, 255/255, 255/255)
Placing.TextStrokeColor3 = Color3.new(255/255, 255/255, 255/255)
Placing.Font = "SourceSans"
Placing.FontSize = "Size42"
Placing.BackgroundTransparency = 1
Placing.TextStrokeTransparency = 0
Space.Value = Space.Value + 0.125
Place.Value = Place.Value + 1
Placing.Parent = Frame
end
end
elseif Event400m.Value == true then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local debounce = FinishedFolder:FindFirstChild(player.Name)
if player.Character and (not debounce) then
local check = Checkpoint1.Container:FindFirstChild(player.Name)
if check then
local finishtag = Instance.new("StringValue")
finishtag.Name = player.Name
finishtag.Value = player.Name
finishtag.Parent = FinishedFolder
local Placing = Instance.new("TextLabel")
Placing.Text = (Place.Value .. ") " .. player.Name .. " - " .. Clock.Text)
Placing.Size = UDim2.new(1, 0, 0.125, 0)
Placing.Position = UDim2.new(0, 0, Space.Value, 0)
Placing.TextColor3 = Color3.new(85/255, 255/255, 255/255)
Placing.TextStrokeColor3 = Color3.new(255/255, 255/255, 255/255)
Placing.Font = "SourceSans"
Placing.FontSize = "Size42"
Placing.BackgroundTransparency = 1
Placing.TextStrokeTransparency = 0
Space.Value = Space.Value + 0.125
Place.Value = Place.Value + 1
Placing.Parent = Frame
end
end
elseif Event800m.Value == true then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local debounce = FinishedFolder:FindFirstChild(player.Name)
if player.Character and (not debounce) then
local check = Checkpoint2.Container:FindFirstChild(player.Name)
if check then
local finishtag = Instance.new("StringValue")
finishtag.Name = player.Name
finishtag.Value = player.Name
finishtag.Parent = FinishedFolder
local Placing = Instance.new("TextLabel")
Placing.Text = (Place.Value .. ") " .. player.Name .. " - " .. Clock.Text)
Placing.Size = UDim2.new(1, 0, 0.125, 0)
Placing.Position = UDim2.new(0, 0, Space.Value, 0)
Placing.TextColor3 = Color3.new(85/255, 255/255, 255/255)
Placing.TextStrokeColor3 = Color3.new(255/255, 255/255, 255/255)
Placing.Font = "SourceSans"
Placing.FontSize = "Size42"
Placing.BackgroundTransparency = 1
Placing.TextStrokeTransparency = 0
Space.Value = Space.Value + 0.125
Place.Value = Place.Value + 1
Placing.Parent = Frame
end
end
elseif Event1600m.Value == true then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local debounce = FinishedFolder:FindFirstChild(player.Name)
if player.Character and (not debounce) then
local check = Checkpoint4.Container:FindFirstChild(player.Name)
if check then
local finishtag = Instance.new("StringValue")
finishtag.Name = player.Name
finishtag.Value = player.Name
finishtag.Parent = FinishedFolder
local Placing = Instance.new("TextLabel")
Placing.Text = (Place.Value .. ") " .. player.Name .. " - " .. Clock.Text)
Placing.Size = UDim2.new(1, 0, 0.125, 0)
Placing.Position = UDim2.new(0, 0, Space.Value, 0)
Placing.TextColor3 = Color3.new(85/255, 255/255, 255/255)
Placing.TextStrokeColor3 = Color3.new(255/255, 255/255, 255/255)
Placing.Font = "SourceSans"
Placing.FontSize = "Size42"
Placing.BackgroundTransparency = 1
Placing.TextStrokeTransparency = 0
Space.Value = Space.Value + 0.125
Place.Value = Place.Value + 1
Placing.Parent = Frame
end
end
end
end
end)
Checkpoint1.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
if Event100m.Value == true or Event200m.Value == true or Event400m.Value == true or Event800m.Value == true or Event1600m.Value == true then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local debounce = Checkpoint1.Container:FindFirstChild(player.Name)
if player.Character and (not debounce) then
local checkpointtag = Instance.new("StringValue")
checkpointtag.Name = player.Name
checkpointtag.Value = player.Name
checkpointtag.Parent = Checkpoint1.Container
end
end
end
end)
Checkpoint2.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
if Event800m.Value == true or Event1600m.Value == true then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local debounce = Checkpoint2.Container:FindFirstChild(player.Name)
if player.Character and (not debounce) then
local check = Checkpoint1.Container:FindFirstChild(player.Name)
if check then
local checkpointtag = Instance.new("StringValue")
checkpointtag.Name = player.Name
checkpointtag.Value = player.Name
checkpointtag.Parent = Checkpoint2.Container
end
end
end
end
end)
Checkpoint3.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
if Event1600m.Value == true then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local debounce = Checkpoint3.Container:FindFirstChild(player.Name)
if player.Character and (not debounce) then
local check = Checkpoint2.Container:FindFirstChild(player.Name)
if check then
local checkpointtag = Instance.new("StringValue")
checkpointtag.Name = player.Name
checkpointtag.Value = player.Name
checkpointtag.Parent = Checkpoint3.Container
end
end
end
end
end)
Checkpoint4.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
if Event1600m.Value == true then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local debounce = Checkpoint4.Container:FindFirstChild(player.Name)
if player.Character and (not debounce) then
local check = Checkpoint3.Container:FindFirstChild(player.Name)
if check then
local checkpointtag = Instance.new("StringValue")
checkpointtag.Name = player.Name
checkpointtag.Value = player.Name
checkpointtag.Parent = Checkpoint4.Container
end
end
end
end
end)

2 comments
Tip: It would be better if you posted the part of the code where the error happens, instead of all of your code
Well its mostly Line 139-150