Advertisement
PeaPattern

ls 1

Apr 17th, 2024
584
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.30 KB | None | 0 0
  1. local SGui = game:GetService("StarterGui")
  2. local TService = game:GetService("TweenService")
  3.  
  4. local Main = script.Parent
  5. local Credits = Main.Credits
  6. local Settings = Main.Settings
  7. local Play = Main.Play
  8. local CamPart = workspace:WaitForChild("CamPart")
  9. local Camera = workspace.CurrentCamera
  10.  
  11. Camera.CameraType = Enum.CameraType.Scriptable
  12. Camera.CFrame = CamPart.CFrame
  13.  
  14. function PlaySfx(sfx)
  15.     local new = sfx:Clone()
  16.     new.Parent = game:GetService("SoundService")
  17.     new:Destroy()
  18. end
  19.  
  20. function UnderlineHover(obj, callback)
  21.     local underline = obj:FindFirstChild("Underline")
  22.     if not underline then return end
  23.    
  24.     local icon = obj:FindFirstChild("Icon")
  25.     if not icon then return end
  26.    
  27.     local enter = TService:Create(underline, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), { BackgroundTransparency = 0 })
  28.     local leave = TService:Create(underline, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), { BackgroundTransparency = 1 })
  29.    
  30.     local enter_text = TService:Create(obj, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), { TextColor3 = Color3.fromRGB(252, 255, 56) })
  31.     local leave_text = TService:Create(obj, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), { TextColor3 = Color3.new(1, 1, 1) })
  32.    
  33.     local enter_underline = TService:Create(underline, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), { BackgroundColor3 = Color3.fromRGB(252, 255, 56) })
  34.     local leave_underline = TService:Create(underline, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), { BackgroundColor3 = Color3.new(1, 1, 1) })
  35.    
  36.     local enter_icon = TService:Create(icon, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), { ImageColor3 = Color3.fromRGB(252, 255, 56) })
  37.     local leave_icon = TService:Create(icon, TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), { ImageColor3 = Color3.new(1, 1, 1) })
  38.    
  39.     local function me()
  40.         enter:Play()
  41.         enter_text:Play()
  42.         enter_underline:Play()
  43.         enter_icon:Play()
  44.         PlaySfx(script.hover)
  45.     end
  46.    
  47.     local function ml()
  48.         leave:Play()
  49.         leave_text:Play()
  50.         leave_underline:Play()
  51.         leave_icon:Play()
  52.         PlaySfx(script.unhover)
  53.     end
  54.    
  55.     local function realCallback()
  56.         callback()
  57.         PlaySfx(script.click)
  58.     end
  59.    
  60.     obj.MouseEnter:Connect(me)
  61.     obj.MouseLeave:Connect(ml)
  62.     icon.MouseEnter:Connect(me)
  63.     icon.MouseLeave:Connect(ml)
  64.     obj.MouseButton1Down:Connect(realCallback)
  65.     icon.MouseButton1Down:Connect(realCallback)
  66. end
  67.  
  68. local _cam = workspace.CurrentCamera
  69. _cam.CameraType = Enum.CameraType.Scriptable
  70. local mouse = game.Players.LocalPlayer:GetMouse()
  71.  
  72. local sensitivity = 0.03
  73.  
  74. local lastMousePosition = mouse.X
  75.  
  76. local Connection = mouse.Move:Connect(function()
  77.     local delta = (mouse.X - lastMousePosition) * sensitivity
  78.     _cam.CFrame = _cam.CFrame * CFrame.Angles(0, math.rad(delta), 0):Inverse()
  79.     lastMousePosition = mouse.X
  80. end)
  81.  
  82.  
  83. SGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
  84.  
  85. UnderlineHover(Credits, function()end)
  86. UnderlineHover(Settings, function()end)
  87. UnderlineHover(Play, function()
  88.     Connection:Disconnect()
  89.     script.Parent.Parent.Parent.Enabled = false
  90.     script.Parent.Parent.Parent.Parent.UI.Enabled = true
  91.     Camera.CameraType = Enum.CameraType.Follow
  92.     SGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
  93. end)
  94.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement