Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tweenService = game:GetService('TweenService')
- local frames = {
- script.Parent:WaitForChild('Top');
- script.Parent:WaitForChild('Backgroundscroll');
- script.Parent.Backgroundscroll.ScrollingFrame:WaitForChild('Person1');
- script.Parent.Backgroundscroll.ScrollingFrame:WaitForChild('Person2');
- script.Parent.Backgroundscroll.ScrollingFrame:WaitForChild('Person3')
- }
- local tweens = {}
- local tweenInfo = TweenInfo.new(0.3)
- local frame1 = script.Parent.Top
- local frame2 = script.Parent.Backgroundscroll
- local frame3 = script.Parent.Backgroundscroll.ScrollingFrame.Person1
- local frame4 = script.Parent.Backgroundscroll.ScrollingFrame.Person2
- local frame5 = script.Parent.Backgroundscroll.ScrollingFrame.Person3
- tweens = {
- [frame1] = {
- ['Open'] = tweenService:Create(frame1, tweenInfo, {Size = UDim2.new(5.2, 0,0.5, 0)});
- ['Close'] = tweenService:Create(frame1, tweenInfo, {Size = UDim2.new(0,0,0,0)});
- ['TimeToWaitBeforeNextFrame'] = 0.3
- };
- [frame2] = {
- ['Open'] = tweenService:Create(frame2, tweenInfo, {Size = UDim2.new(4.98, 0,5.31, 0)});
- ['Close'] = tweenService:Create(frame2, tweenInfo, {Size = UDim2.new(0,0,0,0)});
- ['TimeToWaitBeforeNextFrame'] = 0.7
- };
- [frame3] = {
- ['Open'] = tweenService:Create(frame3, tweenInfo, {Size = UDim2.new(0.944, 0,0.266, 0)});
- ['Close'] = tweenService:Create(frame3, tweenInfo, {Size = UDim2.new(0,0,0,0)});
- ['TimeToWaitBeforeNextFrame'] = 0.5
- };
- [frame4] = {
- ['Open'] = tweenService:Create(frame4, tweenInfo, {Size = UDim2.new(0.944, 0,0.266, 0)});
- ['Close'] = tweenService:Create(frame4, tweenInfo, {Size = UDim2.new(0,0,0,0)});
- ['TimeToWaitBeforeNextFrame'] = 0.5
- };
- [frame5] = {
- ['Open'] = tweenService:Create(frame5, tweenInfo, {Size = UDim2.new(0.944, 0,0.266, 0)});
- ['Close'] = tweenService:Create(frame5, tweenInfo, {Size = UDim2.new(0,0,0,0)});
- ['TimeToWaitBeforeNextFrame'] = 0.5;
- };
- };
- local open = false
- script.Parent.Parent:WaitForChild('Open').MouseButton1Click:Connect(function()
- open = not open
- local tempIsOpen = open
- for i,v in ipairs(frames) do
- if tempIsOpen ~= open then
- return
- end
- local chosenTween = tweens[v][open and 'Open' or 'Close']
- chosenTween:Play()
- task.wait(tweens[v].TimeToWaitBeforeNextFrame)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement