So I have this script to tween a gui when a admin or mod announces something
script.Parent.Parent.Visible = false
local frame = script.Parent.Parent
local topBar = script.Parent.Parent.TopBar
local bottomBar = script.Parent.Parent.BottomBar
local tweenTime = 0.5
local noVisible = {}
noVisible.Position = UDim2.new(0.5,0,.488,0)
noVisible.Size = UDim2.new(0,0,.025,0)
local halfvisible = {}
halfvisible.Position = UDim2.new(.31,0,.488,0)
halfvisible.Size = UDim2.new(.379,0,.025,0)
local visible = {}
visible.Position = UDim2.new(.31,0,.25,0)
visible.Size = UDim2.new(.379,0,.5,0)
local barVisible = {}
barVisible.Size = UDim2.new(1, 0, 0.05, 0)
local barNotVisible = {}
barNotVisible.Size = UDim2.new(1, 0, 1, 0)
game.ReplicatedStorage.DisplayGlobalGui.OnClientEvent:Connect(function(message)
--tween and everything here
frame.Position = noVisible.Position
frame.Size = noVisible.Size
frame.Visible = true
frame:TweenSizeAndPosition(halfvisible.Size, halfvisible.Position, Enum.EasingDirection.In, Enum.EasingStyle.Linear, tweenTime)
wait(tweenTime)
frame:TweenSizeAndPosition(visible.Size, visible.Position, Enum.EasingDirection.In, Enum.EasingStyle.Linear, tweenTime)
wait(tweenTime)
script.Parent.Text = message
for i=1,0,-0.1 do
script.Parent.TextTransparency = i
script.Parent.Parent.TitleText.TextTransparency = i
script.Parent.Parent.PoppinLogo.ImageTransparency = i
wait()
end
wait(5)
for i=0,1,0.1 do
script.Parent.TextTransparency = i
script.Parent.Parent.TitleText.TextTransparency = i
script.Parent.Parent.PoppinLogo.ImageTransparency = i
wait()
end
frame:TweenSizeAndPosition(halfvisible.Size, halfvisible.Position, Enum.EasingDirection.In, Enum.EasingStyle.Linear, tweenTime)
wait(tweenTime)
frame:TweenSizeAndPosition(noVisible.Size, noVisible.Position, Enum.EasingDirection.In, Enum.EasingStyle.Linear, tweenTime)
wait(tweenTime)
script.Parent.Parent.Visible = false
end)
However sometimes it tweens properly (shown below)
And sometimes it does this
I am not sure why it does this, does anyone know? Is it a problem with my code or roblox?
Also, there are no errors when it fails to tween properly