a = game.Workspace.checkpoint

b = game.ServerStorage.Check

function onTouched(part)

local h = part.Parent:findFirstChild("Humanoid")

b.Value = b.Value +1

a.CanCollide = false

wait(3)

a.CanCollide = true

print ("Succesful")

end

script.Parent.Touched:connect(onTouched)

I have this script so when someone touches it, the value of b would go up and then another block after it doing this

a = game.Workspace.entering

b = game.ServerStorage.Check

function onTouched(part)

local h = part.Parent:findFirstChild("Humanoid")

if b.Value == 1 then

b.Value = b.Value - 1

a.CanCollide = false

wait (3)

a.CanCollide = false

else

print("Not allowed to pass")

end

end

script.Parent.Touched:connect(onTouched)

Okay so basically, I'm trying to make a race game and I don't want pepole to go backwards so i put a block to stop them, and i put another block before that so when someone is trying to go through it from the other side the value of b would go up and then when it touched the other block the value of b would be removed and the door is opened for three seconds so the car from the other side can pass.

There isn't any errors on the roblox output, it just isn't working.