Why isn't this working?

Hello!
I’m trying to make it so that if a player enters a zone, the CarZone value is On and if it exits the zone, the RegularZone Value will turn on and the CarZone value will turn off.
However, this script does not seem to work and I do not understand why!
Code:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent.Name == "Jeep" then
		hit.Parent.CarZone.Value = true
		hit.Parent.RegularZone.Value = false
		return
	end
end)
script.Parent.TouchEnded:Connect(function(hit)
	if hit.Parent == nil then
		hit.Parent.CarZone.Value = false
		hit.Parent.RegularZone.Value = true
	end
end)

Could you please help me? Thanks you!

You’re making it so that when the hit variable is done touching, you’re checking if the hit variable’s parent is nil, which makes it so that you check if the hit part isn’t a Jeep, causing the CarValue and RegularZome not to change. So you should check if the hit.Parent is a Jeep.

didn’t work:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent.Name == "Jeep" then
		hit.Parent.CarZone.Value = true
		hit.Parent.RegularZone.Value = false
		return
	end
end)
script.Parent.TouchEnded:Connect(function(hit)
	if hit.Parent.Name ~= "Jeep" then
		hit.Parent.CarZone.Value = false
		hit.Parent.RegularZone.Value = true
	end
end)

CarZone is not a valid member of Model “Workspace.SinClosed”

We don’t know what is being touched nor not touching it. Your code is seeing that an object stopped touching it but isn’t finding the object correctly. Be sure to check that you are correctly finding the CarZon object.

whats the code and idk how to do that