as you can see here there a red button but, there’s also glass, now what I want is a smooth transparency fade, I already have a script to when you break it the only thing I can’t figure out is how to make it smooth (meaning when you break the glass it will reaper in a smooth transparency way.) something like that, btw if your wondering what the glass transparency it’s 0.75 so you can see the button
What solutions have you tried so far? yes but never found my asnwer
local GlassTrans = script.Parent
script.Parent.ClickDetector.MouseClick:Connect(function()
script.Parent.Position = Vector3.new(67.25, 140.7, 2)
script.Parent.ClickDetector.MaxActivationDistance = 0
wait(3)
script.Parent.Position = Vector3.new(67.25, 141.2, 2)
GlassTrans.Transparency = 1
while true do
wait(0.05)
GlassTrans.Transparency = script.Parent.Transparency > 0.01 --I have also try
--using a + - > < but it sometimes seems to either it shows numbers going high up to
--like (1.50) (3.23) or even higher (10.45) which idk why it dose that as it shows it
--invisible or, it puts the transparency 0
print("it's doing it")
if script.Parent.Transparency == 0.75 then
script.Parent.ClickDetector.MaxActivationDistance = 10
print("it broke out")
else
print("might have ended")
break
end
end
end)
do not write entire scripts or design entire systems for you
while item.Transparency > 0 do
item.Transparency -= 0.05 -- The greater this number, the less it takes to fade item
wait(0.1) -- The the lower the number in wait(), the less time it takes to fade item
end
With the above, I’d recommend you keep the num in "item.Transparency -= num relatively small (like 0.05 or whatever works) and adjust the parameter of wait(). This way it fades in more finite adjustments, not in choppy “bulks” at a time.