Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- !strict
- local blur = game.Lighting.Blur
- local settingsFrame = script.Parent.Settings
- local mainFrame = script.Parent.Frame
- local LoadingScreen = script.Parent.Loading
- local ContentProvider = game:GetService("ContentProvider")
- mainFrame.Visible = true
- local ReplicatedFirst = game:GetService("ReplicatedFirst")
- local PlayButton = LoadingScreen:WaitForChild("PlayButton")
- --ReplicatedFirst:RemoveDefaultLoadingScreen()
- -- Controller Support
- local UserInputService = game:GetService("UserInputService")
- local ContextActionService = game:GetService("ContextActionService")
- -- Controller UI
- local ControllerSettingsUI = script.Parent.ControllerSupport.UI.ControllerSettings
- local GamePadSettingsUI = script.Parent.ControllerSupport.UI.GamePadSettings
- local ButtonGradient = Instance.new("UIGradient")
- ButtonGradient.Parent = nil
- ButtonGradient.Enabled = true
- ButtonGradient.Rotation = 90
- local keypoint1 = ColorSequenceKeypoint.new(0, Color3.fromRGB(150, 150, 150))
- local keypoint2 = ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 255, 255))
- ButtonGradient.Color = ColorSequence.new(keypoint1, keypoint2)
- local tweenservice = game.TweenService
- local TInfoParams = TweenInfo.new(0.3,
- Enum.EasingStyle.Sine,
- Enum.EasingDirection.InOut
- )
- blur.Enabled = true
- local Player = game.Players.LocalPlayer
- local Character = Player.Character or Player.CharacterAdded:Wait()
- local Camera = workspace.CurrentCamera
- -- LoadingScreen.Visible = true
- repeat wait()
- Camera.CameraType = Enum.CameraType.Scriptable
- until Camera.CameraType == Enum.CameraType.Scriptable
- Camera.CFrame = workspace.CameraPart.CFrame
- local function PlayGame()
- task.wait(0.1)
- script.Parent.Frame.Visible = false
- tweenservice:Create(blur, TInfoParams, {Size = 0}):Play()
- Camera.CameraType = Enum.CameraType.Custom
- end
- local function OpenSettings()
- settingsFrame.Rotation = 90 -- just to set up the visuals
- settingsFrame.Size = UDim2.new(0, 0, 0, 0)
- wait(0.1)
- game.ReplicatedStorage.Sounds.FrameOpen:Play()
- settingsFrame.Visible = true
- tweenservice:Create(settingsFrame, TInfoParams, {Rotation = -5}):Play()
- tweenservice:Create(settingsFrame, TInfoParams, {Size = UDim2.new(0.31, 0, 0.409, 0)}):Play()
- end
- local function ExitSettings()
- tweenservice:Create(settingsFrame, TInfoParams, {Rotation = 90}):Play()
- tweenservice:Create(settingsFrame, TInfoParams, {Size = UDim2.new(0, 0, 0, 0)}):Play()
- wait(0.32)
- settingsFrame.Visible = false
- end
- mainFrame.PlayButton.MouseButton1Down:Connect(function()
- PlayGame()
- end)
- mainFrame.Settings.MouseButton1Down:Connect(function()
- OpenSettings()
- end)
- settingsFrame.Exit.MouseButton1Down:Connect(function()
- ExitSettings()
- end)
- -- Controller Support
- local DEADZONE: number = 0.1 -- 0-1
- -- Everything Within one Function.
- GamePadSettingsUI.Visible = false
- ControllerSettingsUI.Position = UDim2.new(1.5, 0, 0.502, 0)
- local function OpenGamePadSettingsUI()
- tweenservice:Create(GamePadSettingsUI, TInfoParams, {Position = UDim2.new(0.5, 0, 0.499, 0)}):Play()
- GamePadSettingsUI.Visible = true
- end
- local function CloseGamePadSettingsUI()
- tweenservice:Create(GamePadSettingsUI, TInfoParams, {Position = UDim2.new(0.5, 0, 0, 0)}):Play()
- GamePadSettingsUI.Visible = false
- end
- UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
- if gameProcessedEvent then
- end
- if GamePadSettingsUI.Visible == true then
- if input.KeyCode == Enum.KeyCode.ButtonR2 then
- tweenservice:Create(GamePadSettingsUI, TInfoParams, {Position = UDim2.new(0.5, 0, 0, 0)}):Play()
- GamePadSettingsUI.Visible = false
- script.Beep:Play()
- end
- end
- end)
- UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
- if gameProcessedEvent then
- end
- if input.KeyCode == Enum.KeyCode.Thumbstick1 and input.Position.Magnitude > DEADZONE then
- print(input.Position.X, input.Position.Y)
- if input.Position.X > 0 then
- print("Right GamePad")
- OpenGamePadSettingsUI()
- script.Beep:Play()
- elseif input.Position.X < 0 then
- print("Left GamePad")
- PlayGame()
- script.Beep:Play()
- end
- end
- end)
- UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
- if gameProcessedEvent then
- end
- if input.KeyCode == Enum.KeyCode.ButtonL1 and GamePadSettingsUI.Visible == true then
- CloseGamePadSettingsUI()
- script.Beep:Play()
- end
- end)
- UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
- if gameProcessedEvent then
- end
- if input.KeyCode == Enum.KeyCode.ButtonA and GamePadSettingsUI.Controller.Selected then
- print("Selected")
- ButtonGradient.Parent = GamePadSettingsUI.Controller
- tweenservice:Create(ControllerSettingsUI, TInfoParams, {Position = UDim2.new(0.498, 0, 0.502, 0)}):Play()
- script.Beep:Play()
- end
- end)
- ControllerSettingsUI.SelectionLost:Connect(function()
- print("Selection lost")
- ButtonGradient.Parent = nil
- tweenservice:Create(ControllerSettingsUI, TInfoParams, {Position = UDim2.new(1.5, 0, 0.502, 0)}):Play()
- script.Beep:Play()
- end)
- -- Detect if Keyboard is Enabled
- if UserInputService.KeyboardEnabled then
- local icons = script.Parent.Icons:GetDescendants()
- for _, icon in pairs(icons) do
- if icon:IsA("ImageButton") then
- icon.Visible = false
- end
- end
- end
- if UserInputService.GamepadEnabled then
- local icons = script.Parent.Icons:GetDescendants()
- for _, icon in pairs(icons) do
- if icon:IsA("ImageButton") then
- icon.Visible = true
- end
- end
- end
- local UserInputService = game:GetService("UserInputService")
- local function getActiveGamepad()
- local activeGamepad = nil
- local connectedGamepads = UserInputService:GetConnectedGamepads()
- if #connectedGamepads > 0 then
- for _, gamepad in connectedGamepads do
- if activeGamepad == nil or gamepad.Value < activeGamepad.Value then
- activeGamepad = gamepad
- end
- end
- end
- if activeGamepad == nil then -- Nothing is connected; set up for "Gamepad1"
- activeGamepad = Enum.UserInputType.Gamepad1
- local icons = script.Parent.ControllerSupport.Icons:GetDescendants()
- for _, icon in pairs(icons) do
- if icon:IsA("ImageButton") then
- icon.Visible = false
- end
- end
- end
- return activeGamepad
- end
- if UserInputService.GamepadEnabled then
- local activeGamepad = getActiveGamepad()
- print(activeGamepad)
- end
- local GamePadActive = getActiveGamepad()
- if GamePadActive == false then
- print("No Gamepad Detected")
- -- Repeat Line 118
- local icons = script.Parent.ControllerSupport.Icons:GetDescendants()
- for _, icon in pairs(icons) do
- if icon:IsA("ImageButton") then
- icon.Visible = false
- end
- end
- end
- UserInputService.GamepadConnected:Connect(function(gamepad)
- print("User has connected controller: " .. tostring(gamepad))
- local icons = script.Parent.ControllerSupport.Icons:GetDescendants()
- for _, icon in pairs(icons) do
- if icon:IsA("ImageButton") then
- icon.Visible = true
- end
- end
- end)
- UserInputService.GamepadDisconnected:Connect(function(gamepad)
- print("User has disconnected controller: " .. tostring(gamepad))
- local icons = script.Parent.ControllerSupport.Icons:GetDescendants()
- for _, icon in pairs(icons) do
- if icon:IsA("ImageButton") then
- icon.Visible = false
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment