How do I fix this script for my timing system


  • Im having Trouble finding out how to fix the following error: 22:49:03.790 - Workspace.TimerSystem.FinishWall.Script:142: attempt to index local 'player' (a nil value)

    This is the part thats having issues:

    Checkpoint1.Touched:connect(function(hit)
    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)


  • If your post will not be a SH Discussion, do not post it in this category. This should be posted in commons. Even then, scripting assistance should be asked for on the main site.


  • Change the line 6 condition to if (player and player.Character and (not debounce)) then


  • @sjr04Alt Im sorry im new to using this thanks for the information

Log in to reply
 

Looks like your connection to Scripting Helpers was lost, please wait while we try to reconnect.