First when its been on transparency = 1 you can touch again.
local p = script.Parent local t = "5" function Ontouch() p.Transparency = 0.1 wait(t) p.Transparency = 0.2 wait(t) p.Transparency = 0.3 wait(t) p.Transparency = 0.4 wait(t) p.Transparency = 0.5 wait(t) p.Transparency = 0.6 wait(t) p.Transparency = 0.7 wait(t) p.Transparency = 0.8 wait(t) p.Transparency = 0.9 wait(t) p.Transparency = 1 end p.Touched:connect(Ontouch)
What you want to add is called a 'debounce':
local p = script.Parent local t = 5 --You can't wait "5". :P local deb = false --Our debounce variable function Ontouch() if deb then return end --Don't do anything if debounce is on! deb = true --Turn it on otherwise... for i = .1, .9, .1 do --To avoid repetition p.Transparency = i wait(t) end p.Transparency = 1 deb = false --Now that we're done, turn debounce off! end p.Touched:connect(Ontouch)
local p = script.Parent local t = 5 local defaultTrans = 0 -- plug in the number you want the block's transparency to revert to local touchable = true function Ontouch() -- I made the logic more compressed, and faster to write and go through/edit if touchable then p.Transparency = defaultTrans touchable = false for i = 1, 10 - (defaultTrans * 10) do p.Transparency = p.Transparency + 0.1 wait(t) end touchable = true end end p.Touched:connect(Ontouch)
I hope this helped :D