Logkin

Manager

Mar 27th, 2021
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. --by sirelKilla (v3rm)
  2.  
  3. --vars
  4. local Players = game:GetService("Players")
  5. local player = Players.LocalPlayer
  6. local humanoid = player.Character.Humanoid
  7. local mteam = game:GetService("Teams").Manager
  8. local man = mteam:GetPlayers()[1]
  9. --deletes a glitchy chair in the office (optional)
  10. if workspace:FindFirstChild("ExtraChair") and workspace.ExtraChair:FindFirstChild("Seat") then
  11. workspace.ExtraChair.Seat:Destroy()
  12. end
  13.  
  14. if man then
  15. --check if he's respawning or sitting
  16. local htxt
  17. if man.Character==nil or man.Character:FindFirstChild("HumanoidRootPart")==nil or man.Character:FindFirstChild("Humanoid")==nil then
  18. htxt = "Failed because manager is respawning"
  19. end
  20. local target = man.Character.HumanoidRootPart
  21. if man.Character.Humanoid.Sit then
  22. htxt = "Failed because manager is sitting"
  23. end
  24. if htxt then
  25. local h = Instance.new("Hint",workspace)
  26. h.Text = htxt
  27. wait(3)
  28. h:Destroy()
  29. return
  30. end
  31. --get in a car
  32. if not workspace.Cars:IsAncestorOf(humanoid.SeatPart) then
  33. humanoid.Jump=true
  34. wait(0.1)
  35. for _,car in ipairs(workspace.Cars:GetChildren()) do
  36. if car:FindFirstChild("Driver") and car.Driver.Occupant==nil and car:FindFirstChild("Owner") and car.Owner.Value==nil then
  37. car.Driver:Sit(humanoid)
  38. wait(0.3)
  39. if humanoid.SeatPart then
  40. break
  41. end
  42. end
  43. end
  44. end
  45. local seat = humanoid.SeatPart
  46. local car = seat.Parent
  47. local returncf = CFrame.new(14,-4.5,21)*CFrame.Angles(0,math.pi/2,0)
  48. for j=1,4 do
  49. --attempt to sit manager
  50. seat.Anchored=false
  51. local e = 0
  52. while car.HoodSeat.Occupant==nil and mteam:GetPlayers()[1] and target.Parent and e<5 do
  53. local newpos = target.Position+Vector3.new(0,-3,0)+target.CFrame.lookVector*5.5+target.Velocity*.7
  54. local flatdir = (target.CFrame.lookVector*Vector3.new(1,0,1)).Unit --target's looking direction, flattened
  55. if not (flatdir.x < 2) then --inf
  56. flatdir = Vector3.new(1,0,0)
  57. end
  58. car:SetPrimaryPartCFrame(CFrame.new(newpos,newpos-flatdir))
  59. seat.Velocity=Vector3.new()
  60. local e2=0
  61. while car.HoodSeat.Occupant==nil and mteam:GetPlayers()[1] and target.Parent and e2<0.7 do
  62. e2=e2+wait()
  63. end
  64. e=e+e2
  65. end
  66. --attempt to move manager
  67. car:SetPrimaryPartCFrame(returncf)
  68. wait(.1)
  69. car:SetPrimaryPartCFrame(returncf)
  70. seat.Anchored=true
  71. e = 0
  72. while mteam:GetPlayers()[1] and target.Parent and e<1 do
  73. e=e+wait()
  74. end
  75. car.HoodSeat:ClearAllChildren() --unsits anyone
  76. e = 0
  77. while mteam:GetPlayers()[1] and target.Parent and e<0.5 do
  78. e=e+wait()
  79. end
  80. if mteam:GetPlayers()[1]==nil or target.Parent==nil then
  81. break
  82. end
  83. end
  84. --reset car
  85. seat.Anchored=false
  86. wait()
  87. car:SetPrimaryPartCFrame(CFrame.new(120,10,-75))
  88. wait()
  89. end
  90.  
  91. --become manager
  92. humanoid.Jump=true
  93. wait(0.1)
  94. pcall(function() workspace.ManagerChair.Seat:Sit(humanoid) end)
  95. wait(0.3)
  96. humanoid.Jump=true
  97. wait(0.1)
  98. player.Character.HumanoidRootPart.CFrame = player.Character.HumanoidRootPart.CFrame+Vector3.new(5,5,6)
Advertisement
Add Comment
Please, Sign In to add comment