Joriangames

Spectate Gui localscript

Feb 11th, 2021 (edited)
3,113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.22 KB | None | 0 0
  1. --Thanks for using this script
  2. --This script is made by Joriangames/Problox Studio Scripts
  3. --Want to know how to use this? Watch my tutorial: https://youtu.be/T65gtxrukQg
  4. local button = script.Parent.OpenSpectate
  5. local frame = script.Parent.Frame
  6. local title = frame.PlrName
  7. local left = frame.Left
  8. local right = frame.Right
  9. local cam = workspace.CurrentCamera
  10. local num = 1
  11. local plr = game.Players.LocalPlayer
  12.  
  13. button.MouseButton1Click:Connect(function()
  14.     if frame.Visible == true then
  15.         frame.Visible = false
  16.         title.Text = plr.Name
  17.         cam.CameraSubject = plr.Character.Humanoid
  18.         num = 1
  19.     else
  20.         frame.Visible = true
  21.         title.Text = plr.Name
  22.         cam.CameraSubject = plr.Character.Humanoid
  23.         num = 1
  24.     end
  25. end)
  26.  
  27. right.MouseButton1Click:Connect(function()
  28.     local players = game.Players:GetPlayers()
  29.     local all = #players
  30.     num = num +1
  31.     if num > all then
  32.         num = 1
  33.     end
  34.     cam.CameraSubject = players[num].Character.Humanoid
  35.     title.Text = players[num].Name
  36. end)
  37.  
  38. left.MouseButton1Click:Connect(function()
  39.     local players = game.Players:GetPlayers()
  40.     local all = #players
  41.     num = num -1
  42.     if num < 1 then
  43.         num = all
  44.     end
  45.     cam.CameraSubject = players[num].Character.Humanoid
  46.     title.Text = players[num].Name
  47. end)
Add Comment
Please, Sign In to add comment