It seems you are trying to use a for loop, but you used it incorrectly. in order to slowly fade the transparency of your part.
function onTouched()
script.Parent.CanCollide = false
for i = 0, 1 ,0.1 do
script.Parent.Transparency = i
wait(0.1)
end
wait(3)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
script.Parent.Touched:Connect(onTouched)
What this should do is turn off the part's collision after you touch it, and then it will slowly become transparent, increasing transparency by 0.1 every 0.1 seconds. After it becomes fully transparent, it will wait 3 seconds, and then set the part's transparency back to 0 and enables collision.
Let me know if you encounter any problems or if you need any additional help.
1 comment
I'd recommend you use TweenService for this