This worked for me.
local r = true
script.Parent.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and r == true then
r = false
repeat script.Parent.Transparency += 0.1 wait(0.1) until script.Parent.Transparency >= 1
script.Parent.CanCollide = false
wait(2)
repeat script.Parent.Transparency += -0.1 wait(0.1) until script.Parent.Transparency <= 0
script.Parent.CanCollide = true
r = true
end
end)