Hey! I’m trying to make a notification system, and I need it to only play the tween if the textlabel’s parent is Player GUI, then to reverse the tween. This is my code so far, but it will only play the tween, with no checks.
local Start = UDim2.new(0.302, 0,0,0)
local End = UDim2.new(0.302,0,0.223,0)
local guiObject = script.Parent
local function callback(state)
if state == Enum.TweenStatus.Completed then
print("The tween completed uninterrupted")
elseif state == Enum.TweenStatus.Canceled then
print("Another tween cancelled this one")
end
end
-- Initialize the GuiObject position, then start the tween:
guiObject.Position = Start
local willPlay = guiObject:TweenPosition(
End, -- Final position the tween should reach
Enum.EasingDirection.In, -- Direction of the easing
Enum.EasingStyle.Bounce, -- Kind of easing to apply
2, -- Duration of the tween in seconds
true, -- Whether in-progress tweens are interrupted
callback -- Function to be callled when on completion/cancelation
)
if willPlay then
print("The tween will play")
else
print("The tween will not play")
end