Fr4st3yyt

Main Menu Script

Jul 3rd, 2024
3,026
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | Source Code | 0 0
  1. local Camera = workspace.CurrentCamera
  2. local Current = 1
  3.  
  4. local play = script.Parent.Play
  5. local Store = script.Parent.Store
  6. local Exit = script.Parent.Exit
  7.  
  8. local Runservice = game:GetService("RunService")
  9.  
  10. local Cameras = workspace.Cameras
  11.  
  12. local Mouse = game.Players.LocalPlayer:GetMouse()
  13.  
  14. local Move = 150
  15.  
  16. local player = game.Players.LocalPlayer
  17.  
  18. local function updateCamera()
  19.    
  20.     local Centre = Cameras[Current].CFrame
  21.     local MoveVector = Vector3.new((Mouse.X - Centre.X) / Move, (Mouse.Y - Centre.Y) / Move, 0)
  22.     Camera.CFrame = Cameras[Current].CFrame * CFrame.Angles(math.rad(-(Mouse.Y - Centre.Y) / Move), math.rad(-(Mouse.X - Centre.X) / Move), 0)
  23. end
  24.  
  25. play.MouseEnter:Connect(function()
  26.     Current = 1
  27. end)
  28.  
  29. Store.MouseEnter:Connect(function()
  30.     Current = 2
  31. end)
  32.  
  33. Exit.MouseEnter:Connect(function()
  34.     Current = 3
  35. end)
  36.  
  37. play.MouseButton1Click:Connect(function()
  38.     script.Parent:Destroy()
  39. end)
  40.  
  41. Exit.MouseButton1Click:Connect(function()
  42.     player:Kick("You Exited The Game")
  43. end)
  44.  
  45. Runservice.RenderStepped:Connect(updateCamera)
Advertisement
Add Comment
Please, Sign In to add comment