Hi everyone. I’m a little stumped on how I can attempt to make this Frame’s background transparency 0.6 in exactly 1 second. TweenService did work, but tweens can be pretty annoying to deal with sometimes and it was definitely not working for this. How can I make this work?
Again, my goal is to make the BackgroundTransparency = 0.6 by the time 1 second passes just like TweenService. If you can help me, that’d be greatly appreciated.
So, what should I put in replacement of math.max? So far, it isn’t working. I also changed the += to -= because I realized the += would mean I wanted to add to the transparency instead of removing from it.
I have a pretty big system, and using TweenService doesn’t work for it. I would use lerping, but I also can’t do that because you can’t lerp transparency sadly.
local function Lerp(object, property: string, value: any, seconds: number)
local startTime = tick()
local start = object[property]
local goal = value
-- add task.spawn() to make the function not yield
while tick() - startTime <= seconds do
object[property] = start + ((goal - start) * (tick() - startTime) / seconds)
task.wait()
end
end
Thank you so much for this. This worked like a charm. I will forever remember this function for future use. Again, thank you so much. Consider your solution box checked.