First thing first, your main problem.
You forgot an end at then very end of your script. But you should put the new end in line 20.
But that would crash studio, for it runs too fast.
replace while true do with while wait() do .
even though the while wait is not needed.
And you may want to reorder the script a bit, but I did it for you.
debounce=false
script.Parent.Touched:connect(function(hit)
if not debounce then
debounce=true
for i=1,5 do
script.Parent.Transparency=script.Parent.Transparency+0.2
wait(.1)
end
script.Parent.CanCollide = false
wait(3)
script.Parent.CanCollide = true
for i=1,5 do
script.Parent.Transparency=script.Parent.Transparency-0.2
wait(.1)
end
wait(1)
debounce=false
end
end)
hope I helped!
Chemz