I’ve been trying to make a Blinking effect on my game so at a certain part in the game the two frames would tween to make it look like I just blinked my script is kinda faulty and it doesn’t look natural and I have 0 clues how to make a natural blinking effect.
So if someone could show me how that would be great.
local tweenService = game:GetService("TweenService");
local holder = script.Parent;
local upperLid, lowerLid = holder.UpperLid, holder.LowerLid;
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingStyle.InOut, 0, true); -- The true in here at the end makes it reverse so that we get a nice tween in and out.
local upperLidTween, lowerLidTween = tweenService:Create(upperLid, tweenInfo, {Position = UDim2.fromScale(0, 0);}),
tweenService:Create(LowerLid, tweenInfo, {Position = UDim2.fromScale(0, 0.5);});
function doBlink()
upperLidTween:Play();
lowerLidTween:Play();
lowerLidTween.Completed:Wait(); --Should make the code after doBlink() wait to continue
end;
print("We gonna blink");
doBlink();
print("We finished blinking");
CODE HAS NOT BEEN TESTED AND WAS MAKE IN THE EDITOR ON THE DEVFORUM. IT SHOULD WORK AND IF IT DOESN’T, LET ME KNOW AND I’LL FIX IT.
local tweenService = game:GetService("TweenService");
local holder = script.Parent;
local upperLid, lowerLid = holder.UpperLid, holder.LowerLid;
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, true); -- The true in here at the end makes it reverse so that we get a nice tween in and out.
local upperLidTween, lowerLidTween = tweenService:Create(upperLid, tweenInfo, {Position = UDim2.fromScale(0, 0);}),
tweenService:Create(lowerLid, tweenInfo, {Position = UDim2.fromScale(0, 0.5);});
function doBlink()
upperLidTween:Play();
lowerLidTween:Play();
lowerLidTween.Completed:Wait(); --Should make the code after doBlink() wait to continue
end;
print("We gonna blink");
doBlink();
print("We finished blinking");