✓ Accepted answer
So, first, imagine solving this problem without the context of Touched.
We would do exactly what you said:
while true do
wait(0.2)
local bsTransparency = b.Transparency
b.Transparency = bsTransparency + 0.1
end
Then we just can put this inside of our touched function:
local b = script.Parent
function onTouch(part)
while true do
wait(0.2)
local bsTransparency = b.Transparency
b.Transparency = bsTransparency + 0.1
end
end
b.Touched:connect(onTouch)
This will more or less work. Two ideas to improve it: add a debounce and reset the transparency to 0 each time it gets touched.
1 comment
Thanks for this, but I was using this for a tycoon, and the buttons would slowly fade away.