How can i check with region3d if the player is no longer on the part

I already made a script but sometimes the part stuff freezes and idk why

	local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	if Player1.Value ~= nil then
		local s = true
		local partsinregion = game.Workspace:FindPartsInRegion3WithWhiteList(region, {plr.Character["HumanoidRootPart"]}, 100)
		for i,v in pairs(partsinregion) do

			s = false


		if s == true then
			script.Parent.Pad1.Pad1.Color = Color3.fromRGB(163, 162, 165)
			script.Parent.Pad1.Pad1.Material = "Plastic"
			Player1.Value = nil

			s = true

Region3 is deprecated, GetPartsInParts is the replacement.

Just a suggestion but what i always do to check if a player is in a region i just do a raycast from the HumanoidRootPart and whitelist the part that acts as the region. If there is a result then the character is inside the region.

The docs have a good example that fits this scenario, i’ll link it below: