Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- ## This controller controls all gui input, and navigation from the "Main Menus", which are:
- * Team Selection
- * Shop
- * In-Game Settings
- * Tasks (yet to be added)
- * Rewards (yet to be added)
- ## You can enter the previously mentioned Main Menus from the main menu and the in-game side buttons
- ## Aside from that this controller Initializes all the main menus (populating buttons, setting up connections, and clean up)
- ]]
- --!== ================================================================================||>
- --!== SERVICES
- --!== ================================================================================||>
- local Players = game:GetService("Players")
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local Teams = game:GetService("Teams")
- local StarterGui = game:GetService("StarterGui")
- local TweenService = game:GetService("TweenService")
- local CollectionService = game:GetService('CollectionService')
- --!== ================================================================================||>
- --!== DEPENDENCIES
- --!== ================================================================================||>
- --=============================== Data Modules ===============================||>
- local Data = ReplicatedStorage:FindFirstChild("Data")
- local Events = ReplicatedStorage:FindFirstChild("Events")
- local Enums = require(Data:FindFirstChild("Enums"))
- local Structs = require(Data:FindFirstChild("Structs"))
- local InGameSettingsData = require(Data:FindFirstChild("InGameSettingsData"))
- local RolesComponent = require(Data:FindFirstChild("RolesComponent"))
- --=============================== Utils ===============================||>
- local Packages: Folder = ReplicatedStorage.Packages
- local Trove = require(Packages.Trove)
- --!== ================================================================================||>
- --!== MAIN MENUS RUNTIME
- --!== ================================================================================||>
- --=============================== Upvalues ===============================||>
- local LocalPlayer: Player = Players.LocalPlayer
- local PlayerGui: PlayerGui = Players.LocalPlayer.PlayerGui
- local BUTTON_HOVER_HIGHLIGHT = Color3.fromRGB(255, 255, 255)
- local ROLE_SELECTED_HIGHLIGHT = Color3.fromRGB(255, 255, 155)
- ---* Enums ||>
- local RolesEnum = Enums.RolesEnum.Roles
- ---* Main Menu Cinematics Upvalues ||>
- local Camera: Camera = workspace.CurrentCamera
- local CurrentCinematicCamTween: Tween = nil
- local stopCinematics: boolean = false
- ---* Remote Events ||>
- local EnterRoleSelection: RemoteEvent = Events:FindFirstChild("EnterRoleSelection")
- local ExitRoleSelection: RemoteEvent = Events:FindFirstChild("ExitRoleSelection")
- local SetRole: RemoteEvent = Events:FindFirstChild("SetRole")
- local RoleSelected: RemoteEvent = Events:FindFirstChild("RoleSelected")
- local EnterGame: RemoteEvent= Events:FindFirstChild("EnterGame")
- ---* Signals ||>
- local StopMainMenuCinematics = Enums.Signals.StopMainMenuCinematics
- local SetHudVisibility = Enums.Signals.SetHudVisibility
- ---* Player Data Folders ||>
- local plrStates = LocalPlayer:WaitForChild("States")
- local InMainMenu: BoolValue = plrStates:FindFirstChild("InMainMenu")
- local InGame: BoolValue = plrStates:FindFirstChild("InGame")
- local SelectingRole: BoolValue = plrStates:FindFirstChild("SelectingRole")
- local InMenu: BoolValue = plrStates:FindFirstChild("InMenu")
- local plrRoles = LocalPlayer:WaitForChild("Roles")
- local OwnedRoles = plrRoles:FindFirstChild("OwnedRoles")
- --#! NOTE
- --## Collection Service tags behavior is used to handle state to not depend on a hardcoded ui path
- --## Which changes A TON (I shuffle things around a lot)
- -- !== ================================================================================||>
- -- !== Main Menus Screen Gui's Initialization
- -- !== ================================================================================||>
- --## Hides the defult Roblox leaderboard
- StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
- --## SetTrove
- local MainMenuTrove = Trove.new()
- --## Set Main Menus initial state when player joins
- local MainMenus: Folder = PlayerGui:WaitForChild("MainMenus")
- local MainMenuGui: ScreenGui = MainMenus.MainMenu
- MainMenuGui.Enabled = true
- MainMenuGui.ResetOnSpawn = false
- local SideButtonsGui: ScreenGui = MainMenus.SideButtons
- SideButtonsGui.Enabled = false
- SideButtonsGui.ResetOnSpawn = false
- local TeamSelectionGui: ScreenGui = MainMenus.TeamSelection
- TeamSelectionGui.Enabled = false
- TeamSelectionGui.ResetOnSpawn = false
- local ShopGui: ScreenGui = MainMenus.Shop
- ShopGui.Enabled = false
- ShopGui.ResetOnSpawn = false
- local InGameSettingsGui: ScreenGui = MainMenus.InGameSettings
- InGameSettingsGui.Enabled = false
- InGameSettingsGui.ResetOnSpawn = false
- local TasksGui: ScreenGui = MainMenus.Tasks
- TasksGui.Enabled = false
- TasksGui.ResetOnSpawn = false
- local RewardsGui: ScreenGui = MainMenus.Rewards
- RewardsGui.Enabled = false
- RewardsGui.ResetOnSpawn = false
- -- =============================== Main menus buttons generic behaviors ===============================||>
- --## Close the Main menu when clicked
- for _, menuBtn: ImageButton in CollectionService:GetTagged("MainMenuBtn") do
- menuBtn.MouseButton1Click:Connect(function()
- MainMenuGui.Enabled = false
- end)
- end
- ---* Main Menus back btns ||>
- --## All back buttons either go close the HUD (if in game) or go back to the main menu (if in main menu)
- for _, backBtn: ImageButton in CollectionService:GetTagged("BackBtn") do
- backBtn.MouseButton1Click:Connect(function()
- if InMainMenu.Value then
- MainMenuGui.Enabled = true
- elseif InGame.Value then
- InMenu.Value = false
- SetHudVisibility:Fire(true) --## when pressing a backBtn while in-game, show the HUD
- end
- end)
- end
- ---* Enter game button ||>
- for _, enterGameBtn: GuiButton in CollectionService:GetTagged("EnterGameBtn") do
- --## stop camera cinematics And change Player GUI state to in-game
- MainMenuTrove:Add(enterGameBtn.MouseButton1Click:Connect(function()
- EnterGame:FireServer()
- end))
- end
- ---* Enter game (Exit Main Menu), turn off in-game cinematics ||>
- --## And change Player GUI state to in-game
- local ChangeBtn: ImageButton = TeamSelectionGui:FindFirstChild("ChangeButton", true)
- local PlayBtn: ImageButton = TeamSelectionGui:FindFirstChild("PlayButton", true)
- EnterGame.OnClientEvent:Connect(function()
- --## the change btn is under the playbtn, this is just for
- --## Flavour reasons (sure I could have changed the text but it's whatever).
- PlayBtn.Visible = false
- ChangeBtn.Visible = true
- stopCinematics = true
- TeamSelectionGui.Enabled = false
- CurrentCinematicCamTween:Cancel()
- Camera.CameraType = Enum.CameraType.Custom
- Camera.CameraSubject = LocalPlayer.Character
- SetHudVisibility:Fire(true) --## Enable the HUD
- MainMenuTrove:Destroy()
- EnterGame:FireServer()
- StopMainMenuCinematics:Fire()
- end)
- ---* Entry Points||>
- --## Note that both the Main Menu and side buttons are the entry points for:
- --## Shop, Team selection, Tasks, In-game settings, rewards, etc!
- --=============================== Main Menu ===============================||>
- --#! this gui only shows up once when the player joins the game.
- do
- local MenuButtonsFrame: Frame = MainMenuGui.Container.MenuButtonsFrame
- --## Play Button goes to team selection menu, which is already handled via
- --## Enter EnterRolesMenuBtn Tag, therefor ommited
- local ShopBtn: ImageButton = MenuButtonsFrame.ShopButton
- ShopBtn.MouseButton1Click:Connect(function()
- ShopGui.Enabled = true
- end)
- local InGameSettingsButton: ImageButton = MenuButtonsFrame.InGameSettingsButton
- MainMenuTrove:Add(InGameSettingsButton.MouseButton1Click:Connect(function()
- InGameSettingsGui.Enabled = true
- end))
- end
- --=============================== Side Buttons ===============================||>
- --#! This gui only show up in-game.
- do
- --## When the player spawns enable the side buttons gui
- StopMainMenuCinematics:Connect(function()
- SideButtonsGui.Enabled = true
- end)
- --## Listen for side buttons being clicked for menus
- --## Visibility
- local ShopBtnCont: ImageLabel = SideButtonsGui.Container.ShopButtonFrame
- local ShopBtn: ImageButton = ShopBtnCont.ShopButton
- ShopBtn.MouseButton1Click:Connect(function()
- ShopGui.Enabled = true
- end)
- local InGameSettingsBtnCont: ImageLabel = SideButtonsGui.Container.InGameSettingsButtonFrame
- local InGameSettingsBtn: ImageButton = InGameSettingsBtnCont.InGameSettingsButton
- InGameSettingsBtn.MouseButton1Click:Connect(function()
- InGameSettingsGui.Enabled = true
- end)
- local TeamsBtnCont: ImageLabel = SideButtonsGui.Container.TeamsButtonFrame
- local TeamsBtn: ImageButton = TeamsBtnCont.TeamsButton
- TeamsBtn.MouseButton1Click:Connect(function()
- TeamSelectionGui.Enabled = true
- end)
- local TasksBtnFrame: ImageLabel = SideButtonsGui.Container.TasksButtonFrame
- local TasksBtn: ImageButton = TasksBtnFrame.TasksButton
- TasksBtn.MouseButton1Click:Connect(function()
- TasksGui.Enabled = true
- end)
- local RewardsBtnFrame: ImageLabel = SideButtonsGui.Container.RewardsButtonFrame
- local RewardsBtn: ImageButton = RewardsBtnFrame.RewardsButton
- RewardsBtn.MouseButton1Click:Connect(function()
- RewardsGui.Enabled = true
- end)
- end
- for _, sideButton: ImageButton in CollectionService:GetTagged("SideButtons_SideBtn") do
- sideButton.MouseButton1Click:Connect(function()
- SideButtonsGui.Enabled = false
- SetHudVisibility:Fire(false) --## Hide the HUD when a side button is clicked
- end)
- end
- ---* Side buttons Visual modifiers ||>
- --## Highlight the side button when hobbered
- for _, sideBtnFrame: GuiLabel in CollectionService:GetTagged("SideButtons_SideBtnFrame") do
- local SelectionFrame: Frame = sideBtnFrame:FindFirstChild("SelectionFrame")
- sideBtnFrame.MouseEnter:Connect(function()
- SelectionFrame.Visible = true
- end)
- sideBtnFrame.MouseLeave:Connect(function()
- SelectionFrame.Visible = false
- end)
- --## mouse leave wont trigger when the side buttons are hidden sooo
- --## This is to hide the highlight
- SideButtonsGui:GetPropertyChangedSignal("Enabled"):Connect(function()
- if SideButtonsGui.Enabled then
- SelectionFrame.Visible = false
- end
- end)
- end
- ---* Main Menus||>
- -- !== ================================================================================||>
- -- !== Role Selection Gui Initialization
- -- !== ================================================================================||>
- do
- -- =============================== Roles menu elements initialization ===============================||>
- local rolesList: Structs.Array<string> = RolesComponent.GetRolesList()
- local rolesNames: Structs.Array<string> = RolesComponent.GetRolesNames()
- local rolesThumbails: Structs.Array<string> = RolesComponent.GetRoleThumbnails()
- local lockedRoles = RolesComponent:GetLockedRoles()
- local rolesUnlockedByLeveling = RolesComponent:GetRolesUnlockedByLeveling()
- local plrOwnedRoles: Folder & Structs.RoleComponent = LocalPlayer:FindFirstChild("OwnedRoles", true)
- local RolesButtonsMenu: ScrollingFrame = TeamSelectionGui:FindFirstChild("TeamButtonsScrollingFrame", true)
- local RoleBtnElem: ImageButton = CollectionService:GetTagged("RoleBtn")[1]
- --## Populate the team selection gui with all team buttons & initialize buttons appearance
- for roleIndexKey: number, roleName: string in rolesList do
- ---* RoleBtn basic appearance ||>
- local NewRoleButton:ImageButton = RoleBtnElem:Clone()
- NewRoleButton.Name = roleName
- NewRoleButton.Visible = true
- NewRoleButton.LayoutOrder = roleIndexKey
- local TeamNameLabel: TextLabel = NewRoleButton:FindFirstChild("NameTextLabel", true)
- TeamNameLabel.Text = rolesNames[roleIndexKey]
- local TeamThumbnail: ImageLabel = NewRoleButton:FindFirstChild("ThumbnailImageLabel", true)
- TeamThumbnail.Image = rolesThumbails[roleIndexKey] or rolesThumbails[2]
- ---* RoleBtn locked overlay, ||>
- local LockedOverlay: Frame = NewRoleButton:FindFirstChild("LockedOverlayFrame")
- --## If the role's is in the locked roles table then!
- --## Fill in in the unlock information
- local UnlockRequirementText: TextLabel = LockedOverlay:FindFirstChild("UnlockRequirementTextLabel", true)
- local roleIsLocked: boolean = lockedRoles[roleIndexKey]
- if roleIsLocked then
- local levelNeeded = rolesUnlockedByLeveling[roleIndexKey]
- UnlockRequirementText.Text = "Level "..tostring(levelNeeded)
- end
- --## If the player DOES NOT own the role then make the locked overlay visible
- --## And flag it so visual modifiers do not apply to it
- local ownsRole: BoolValue = plrOwnedRoles[roleName]
- if ownsRole.Value == false then
- LockedOverlay.Visible = true
- CollectionService:AddTag(NewRoleButton, "RolesMenu_LockedRoleBtn")
- end
- local rolePlayerLimit = RolesComponent.GetRolePlayerLimit(roleIndexKey)
- local TeamLimitFrame: Frame = NewRoleButton:FindFirstChild("TeamLimitFrame")
- local TeamLimitText: TextLabel = TeamLimitFrame:FindFirstChild("TeamLimitTextLabel")
- if rolePlayerLimit then
- TeamLimitText.Text = tostring(0).."/"..tostring(rolePlayerLimit)
- else
- TeamLimitText.Text = tostring(0).."/".."∞"
- end
- NewRoleButton.MouseButton1Click:Connect(function()
- if CollectionService:HasTag(NewRoleButton, "RolesMenu_LockedRoleBtn") then return end
- CollectionService:AddTag(NewRoleButton, "RoleBtn_Selected")
- end)
- NewRoleButton.MouseEnter:Connect(function()
- if CollectionService:HasTag(NewRoleButton, "RolesMenu_LockedRoleBtn") then return end
- CollectionService:AddTag(NewRoleButton, "RoleBtn_Hover")
- end)
- NewRoleButton.MouseLeave:Connect(function()
- if CollectionService:HasTag(NewRoleButton, "RoleBtn_Selected") then return end
- CollectionService:RemoveTag(NewRoleButton, "RoleBtn_Hover")
- end)
- NewRoleButton.Parent = RolesButtonsMenu
- end
- -- =============================== Roles Menu Elements generic behaviors & modifiers ===============================||>
- local function UpdateRolePlayerCountText(roleBtnName, roleIndexKey)
- local rolePlayerLimit: Structs.Array<number> = RolesComponent.GetRolePlayerLimit(roleIndexKey)
- local playersInRole: number = #CollectionService:GetTagged(roleBtnName)
- local RoleBtn: ImageButton = RolesButtonsMenu:FindFirstChild(roleBtnName, true)
- local TeamLimitFrame: Frame = RoleBtn:FindFirstChild("TeamLimitFrame")
- local TeamLimitText: TextLabel = TeamLimitFrame:FindFirstChild("TeamLimitTextLabel")
- if rolePlayerLimit then
- TeamLimitText.Text = tostring(playersInRole).."/"..tostring(rolePlayerLimit)
- else
- TeamLimitText.Text = tostring(playersInRole).."/".."∞"
- end
- end
- ---* Roles Menu State & Navigation ||>
- for _, enterRolesMenuBtn: GuiButton in CollectionService:GetTagged("EnterRolesMenuBtn") do
- enterRolesMenuBtn.MouseButton1Click:Connect(function()
- EnterRoleSelection:FireServer()
- TeamSelectionGui.Enabled = true
- end)
- end
- for _, exitRolesMenuBtn: GuiButton in CollectionService:GetTagged("ExitRolesMenuBtn") do
- exitRolesMenuBtn.MouseButton1Click:Connect(function()
- ExitRoleSelection:FireServer()
- TeamSelectionGui.Enabled = false
- local SelectedRoleBtn = CollectionService:GetTagged("RoleBtn_Selected")[1]
- CollectionService:RemoveTag(SelectedRoleBtn, "RoleBtn_Selected")
- end)
- end
- for _, setRoleBtn: GuiButton in CollectionService:GetTagged("SetRolesBtn") do
- setRoleBtn.MouseButton1Click:Connect(function()
- if SelectingRole.Value == true then return end
- local SelectedRoleBtn = CollectionService:GetTagged("RoleBtn_Selected")[1]
- SetRole:FireServer(SelectedRoleBtn.Name)
- end)
- end
- for _, roleBtn: GuiButton in CollectionService:GetTagged("RoleBtn") do
- --## Request to set/change role
- roleBtn.MouseButton1Click:Connect(function()
- print(roleBtn)
- RoleSelected:FireServer(roleBtn.Name) --> flips menu state
- end)
- end
- SetRole.OnClientEvent:Connect(function()
- TeamSelectionGui.Enabled = false
- SideButtonsGui.Enabled = true
- SetHudVisibility:Fire(true)
- local PreviouslySelectedRoleBtn = CollectionService:GetTagged("RoleBtn_Selected")[1]
- CollectionService:RemoveTag(PreviouslySelectedRoleBtn, "RoleBtn_Selected")
- end)
- ---* Roles button Visual modifiers ||>
- CollectionService:GetInstanceAddedSignal("RoleBtn_Selected"):Connect(function(roleBtn: ImageButton)
- --#!//TODO Add sound feedback depending if the team is owned or not
- local SelectionOverlay: Frame = roleBtn:FindFirstChild("SelectionOverlayFrame", true)
- SelectionOverlay.Visible = true
- local OverlayFrame: Frame = SelectionOverlay:FindFirstChild("OverlayFrame")
- OverlayFrame.BackgroundColor3 = ROLE_SELECTED_HIGHLIGHT
- --## Swap the selected role btn if it's different from the curr. selected
- --## That'll also automatically change the selection overlay!
- local PreviouslySelectedRoleBtn = CollectionService:GetTagged("RoleBtn_Selected")[1]
- if PreviouslySelectedRoleBtn.Name == roleBtn.Name then return end
- CollectionService:RemoveTag(PreviouslySelectedRoleBtn, "RoleBtn_Selected")
- end)
- CollectionService:GetInstanceRemovedSignal("RoleBtn_Selected"):Connect(function(roleBtn: ImageButton)
- local SelectionOverlay: Frame = roleBtn:FindFirstChild("SelectionOverlayFrame", true)
- SelectionOverlay.Visible = false
- local OverlayFrame: Frame = SelectionOverlay:FindFirstChild("OverlayFrame")
- OverlayFrame.BackgroundColor3 = BUTTON_HOVER_HIGHLIGHT
- --## When the roleBtn is selected, it will not loose the hover tag on mouse
- --## Leave! Which causes a state bug when the role btn is deselected so to prevent that
- --## We remove the lingering "Hover" tag when the button looses the "Selected" tag.
- CollectionService:RemoveTag(roleBtn, "RoleBtn_Hover")
- end)
- CollectionService:GetInstanceAddedSignal("RoleBtn_Hover"):Connect(function(roleBtn: ImageButton)
- local SelectionOverlay: Frame = roleBtn:FindFirstChild("SelectionOverlayFrame", true)
- SelectionOverlay.Visible = true
- end)
- CollectionService:GetInstanceRemovedSignal("RoleBtn_Hover"):Connect(function(roleBtn: ImageButton)
- local SelectionOverlay: Frame = roleBtn:FindFirstChild("SelectionOverlayFrame", true)
- SelectionOverlay.Visible = false
- end)
- ---* Roles Player count UI update ||>
- for roleIndexKey, roleTag: TextLabel in RolesComponent.GetRolesList() do
- CollectionService:GetInstanceAddedSignal(roleTag):Connect(function()
- UpdateRolePlayerCountText(roleTag, roleIndexKey)
- end)
- end
- for roleIndexKey, roleTag: TextLabel in RolesComponent.GetRolesList() do
- CollectionService:GetInstanceRemovedSignal(roleTag):Connect(function()
- UpdateRolePlayerCountText(roleTag, roleIndexKey)
- end)
- end
- ---* Hide Locked Role overlay if the player unlocks it ||>
- CollectionService:GetInstanceAddedSignal("RoleBtn"):Connect(function(roleBtn: ImageButton)
- local roleOwnershipVal = OwnedRoles:FindFirstChild(roleBtn.Name)
- local LockedOverlay: Frame = roleBtn:FindFirstChild("LockedOverlayFrame")
- roleOwnershipVal.Changed:Connect(function(isOwner)
- LockedOverlay.Visible = not isOwner
- end)
- end)
- end
- --=============================== In-Game Settings Gui Initialization ===============================||>
- do
- local inGameSettings: InGameSettingsList = InGameSettingsData.GetInGameSettingsList()
- local inGameSettingTypes:InGameSettingsTypesEnum = InGameSettingsData.GetInGameSettingTypesEnum()
- ---* Text ||>
- local SettingsFrame: ScrollingFrame = InGameSettingsGui:FindFirstChild("SettingsScrollingFrame", true)
- local SliderAndToggleSettingFrame: Frame = CollectionService:GetTagged("InGameSetting_SliderAndToggle")[1]
- local ToggleSettingFrame: Frame = CollectionService:GetTagged("InGameSetting_Toggle")[1]
- --## Settings factory, Generate and mount In-game settings gui containers into the In-Game settings menu
- task.spawn(function()
- for key, setting: InGameSettingComponent in inGameSettings do
- local newSetting: Frame = nil
- if setting.Type == inGameSettingTypes.SliderAndToggleSetting then
- newSetting = SliderAndToggleSettingFrame:Clone()
- newSetting.Name = key
- elseif setting.Type == inGameSettingTypes.JustToggleSetting then
- newSetting = ToggleSettingFrame:Clone()
- end
- newSetting.Name = key
- newSetting.Visible = true
- local SettingNameLabel: TextLabel = newSetting:FindFirstChild("NameTextLabel", true)
- SettingNameLabel.Text = setting.Name
- newSetting.Parent = SettingsFrame
- end
- end)
- local BackButton: ImageButton = InGameSettingsGui:FindFirstChild("BackButton", true)
- BackButton.MouseButton1Click:Connect(function()
- print("Save behavior not implemented")
- InGameSettingsGui.Enabled = false
- end)
- end
- --=============================== Shop Initialization & Controls ===============================||>
- do
- --## These buttons are just to cycle between both shops and to make
- --## Shop titles and contents visible/invisible
- local CashShop: Frame = ShopGui:FindFirstChild("CashShopFrame", true)
- local CashShopTitle: TextLabel = ShopGui:FindFirstChild("CashShopTitleTextlLabel", true)
- local GamePassesShop: Frame = ShopGui:FindFirstChild("GamepassesShopFrame", true)
- local GamepassesShopTitle: TextLabel = ShopGui:FindFirstChild("GamepassesShopTitleTextLabel", true)
- --#!//TODO Populate both menus here
- local CashShopMenuBtn: ImageButton = ShopGui:FindFirstChild("CashShopMenuButton", true)
- CashShopMenuBtn.MouseButton1Click:Connect(function()
- CashShop.Visible = true
- GamePassesShop.Visible = false
- CashShopTitle.Visible = true
- GamepassesShopTitle.Visible = false
- end)
- local GamepassesBtn: ImageButton = ShopGui:FindFirstChild("GamepassesShopMenuButton", true)
- GamepassesBtn.MouseButton1Click:Connect(function()
- CashShop.Visible = false
- GamePassesShop.Visible = true
- CashShopTitle.Visible = false
- GamepassesShopTitle.Visible = true
- end)
- local BackBtn: ImageButton = ShopGui:FindFirstChild("BackButton", true)
- BackBtn.MouseButton1Click:Connect(function()
- ShopGui.Enabled = false
- end)
- end
- --=============================== Tasks Menu ===============================||>
- do
- local BackBtn: ImageLabel = TasksGui:FindFirstChild("BackButton", true)
- BackBtn.MouseButton1Click:Connect(function()
- TasksGui.Enabled = false
- end)
- end
- --=============================== Daily Rewards Menu ===============================||>
- do
- local ClaimBtn: ImageLabel = RewardsGui:FindFirstChild("ClaimButton", true)
- ClaimBtn.MouseButton1Click:Connect(function()
- RewardsGui.Enabled = false
- SideButtonsGui.Enabled = true
- end)
- local BackBtn: ImageLabel = RewardsGui:FindFirstChild("BackButton", true)
- BackBtn.MouseButton1Click:Connect(function()
- RewardsGui.Enabled = false
- end)
- end
- --=============================== Main Menu Cinnematics ===============================||>
- do
- Camera.CameraType = Enum.CameraType.Scriptable
- local CameraModels: table = workspace.Cameras:GetChildren()
- local TweenInfo = TweenInfo.new(
- 5,
- Enum.EasingStyle.Sine,
- Enum.EasingDirection.InOut,
- 0,
- false,
- 0
- )
- task.spawn(function()
- while true do
- for _, cameraModel: Model in ipairs(CameraModels) do
- if stopCinematics == true then
- break
- end
- local startPoint: CFrame = cameraModel.Camera1.CFrame
- local endPoint: CFrame = cameraModel.Camera2.CFrame
- Camera.CameraSubject = cameraModel.Camera1
- Camera.CFrame = startPoint
- local CameraTween: Tween = TweenService:Create(Camera, TweenInfo, {CFrame = endPoint})
- CurrentCinematicCamTween = CameraTween
- CameraTween:Play()
- CameraTween.Completed:Wait()
- end
- task.wait()
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement