Advertisement
zza

ok

zza
Aug 18th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. cam = game.Workspace.CurrentCamera
  2.  
  3. local bar = script.Parent.Bar
  4. local title = bar.Title
  5. local prev = bar.Previous
  6. local nex = bar.Next
  7. local button = script.Parent.Button
  8.  
  9. function get()
  10. for _,v in pairs(game.Players:GetPlayers()) do
  11. if v.Name == title.Text then
  12. return(_)
  13. end
  14. end
  15. end
  16.  
  17. local debounce = false
  18. button.MouseButton1Click:connect(function()
  19. if debounce == false then debounce = true
  20. button.Text = "Close Spectate"
  21. bar:TweenPosition(UDim2.new(0.5,-100,0.88,-50),"In","Linear",1,true)
  22. pcall(function()
  23. title.Text = game.Players:GetPlayerFromCharacter(cam.CameraSubject.Parent).Name
  24. end)
  25. elseif debounce == true then debounce = false
  26. button.Text = "Open Spectate"
  27. pcall(function() cam.CameraSubject = game.Players.LocalPlayer.Character.Humanoid end)
  28. bar:TweenPosition(UDim2.new(-1,-100,0.88,-50),"In","Linear",1,true)
  29. end
  30. end)
  31.  
  32. prev.MouseButton1Click:connect(function()
  33. wait(0.1)
  34. local players = game.Player:GetPlayers()
  35. local num = get()
  36. if not pcall(function()
  37. cam.CameraSubject = players[num-1].Character.Humanoid
  38. end) then
  39. cam.CameraSubject = players[#players].Character.Humanoid
  40. end
  41. pcall(function()
  42. title.Text = game.Players:GetPlayerFromCharacter(cam.CameraSubject.Parent).Name
  43. end)
  44. end)
  45.  
  46. nex.MouseButton1Click:connect(function()
  47. wait(0.1)
  48. local players = game.Players:GetPlayers()
  49. local num = get()
  50. if not pcall(function()
  51. cam.CameraSubject = players[num+1].Character.Humanoid
  52. end) then
  53. cam.CameraSubject = players[1].Character.Humanoid
  54. end
  55. pcall(function()
  56. title.Text = game.Players:GetPlayerFromCharacter(cam.CameraSubject.Parent).Name
  57. end)
  58. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement