Touched & TouchEnded Problem

thx! good night!!!

local TWS = game:GetService("TweenService")
local In = TWS:Create(script.Parent,TweenInfo.new(0.1,Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0,false,0), {Position = UDim2.new(0.5, 0,0.258, 0)})
local Out = TWS:Create(script.Parent,TweenInfo.new(0.1,Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0,false,0), {Position = UDim2.new(1.5, 0,0.258, 0)})
local obj = workspace.Machines["Egg Machine"].Detector
local plr = game.Players.LocalPlayer.Character

obj.Touched:Connect(function(hit)
	if plr == nil or hit.Name ~= "HumanoidRootPart" then return end
	script.Parent.Parent.Enabled = true
	In:Play()
end)

obj.TouchEnded:Connect(function(hit)
	if plr == nil or hit.Name ~= "HumanoidRootPart" then return end
	Out:Play()
	wait(0.01)
	script.Parent.Parent.Enabled = false
end)