Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local Lighting = game:GetService("Lighting")
- local Workspace = game:GetService("Workspace")
- local TweenService = game:GetService("TweenService")
- local Blur = Lighting:FindFirstChild("Blur") or Instance.new("BlurEffect")
- Blur.Name = "Blur"
- Blur.Parent = Lighting
- Blur.Size = 0
- local Camera = Workspace.CurrentCamera
- local Player = Players.LocalPlayer
- local PlayerGui = Player:WaitForChild("PlayerGui")
- local GuiController = {}
- GuiController.Guis = {
- Top = PlayerGui:WaitForChild("Top"),
- Left = PlayerGui:WaitForChild("Left"),
- Right = PlayerGui:WaitForChild("Right"),
- Help = PlayerGui:WaitForChild("Help"),
- Codes = PlayerGui:WaitForChild("Codes"),
- }
- GuiController.CurrentOpenGui = nil
- function GuiController.SetupGui(ScreenGui, OpenButton, ExitButton)
- local Frame = ScreenGui:WaitForChild("Frame")
- if not Frame then
- return
- end
- Frame.Visible = false
- local function ToggleGui()
- if GuiController.CurrentOpenGui == ScreenGui then
- local BasicInfo = TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.InOut)
- local BlurTween = TweenService:Create(Blur, BasicInfo, {Size = 0})
- BlurTween:Play()
- local CameraTween = TweenService:Create(Camera, BasicInfo, {FieldOfView = 70})
- CameraTween:Play()
- Frame.Visible = false
- GuiController.CurrentOpenGui = nil
- else
- if GuiController.CurrentOpenGui then
- local CurrentFrame = GuiController.CurrentOpenGui:FindFirstChild("Frame")
- if CurrentFrame then
- CurrentFrame.Visible = false
- end
- end
- GuiController.CurrentOpenGui = ScreenGui
- Frame.Visible = true
- local BasicInfo = TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.InOut)
- local BlurTween = TweenService:Create(Blur, BasicInfo, {Size = 24})
- BlurTween:Play()
- local CameraTween = TweenService:Create(Camera, BasicInfo, {FieldOfView = 50})
- CameraTween:Play()
- end
- end
- OpenButton.MouseButton1Click:Connect(ToggleGui)
- ExitButton.MouseButton1Click:Connect(ToggleGui)
- end
- function GuiController.CloseAllGuis()
- for _, Gui in pairs(GuiController.Guis) do
- local Frame = Gui:FindFirstChild("Frame")
- if Frame then
- Frame.Visible = false
- end
- end
- local BasicInfo = TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.InOut)
- local BlurTween = TweenService:Create(Blur, BasicInfo, {Size = 0})
- BlurTween:Play()
- local CameraTween = TweenService:Create(Camera, BasicInfo, {FieldOfView = 70})
- CameraTween:Play()
- GuiController.CurrentOpenGui = nil
- end
- return GuiController
Advertisement
Add Comment
Please, Sign In to add comment