So I have this script that should move a GUI object off screen, ofc it doesnt work and I dont know why!
module.Functions['SlideBack'] = function(element:GuiObject,WaitBool)
local tweens = {}
local Amount = 0
local Finished = 0
local info = TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
for _, item in pairs(element:GetChildren()) do
if item:IsA('GuiObject') then
local position = UDim2.new(item.Position.X.Scale - item.Position.X.Scale,0,item.Position.Y.Scale,0)
tweens[item.Name] = TweenService:Create(item,info, {Position = position})
Amount += 1
end
end
local function play(tween:Tween)
tween:Play()
tween.Completed:Wait()
Finished += 1
end
for _, tween in pairs(tweens) do
task.spawn(play,tween)
end
repeat task.wait() until Amount <= Finished or not WaitBool
return
end
My guess is you just cant tween things off screen, if this is true how can I get the same effect?
Just tween the gui near the end of the screen and make it not visible. Or if you want a nice effect do the same thing but make a transparency loop for a nice effect.
I think the position you’re subtracting in the x-axis is 0, that’s why the window isn’t moving left. I believe you need to try subtracting its size instead.
local position = UDim2.new(item.Position.X.Scale - item.Size.X.Scale,0,item.Position.Y.Scale,0)