Advertisement
Khiet_Le

SIM

May 29th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. --SynapseX Decompiler
  2.  
  3. local Tool = script.Parent
  4. local Handle = Tool:FindFirstChild("Handle")
  5. local Equipped = true
  6. local Player = game.Players.LocalPlayer
  7. repeat
  8. wait()
  9. until Player.Character
  10. wait()
  11. local Character = Player.Character
  12. repeat
  13. wait()
  14. until Character:FindFirstChild("Humanoid")
  15. wait()
  16. local Humanoid = Character:FindFirstChild("Humanoid")
  17. local Head = Character:FindFirstChild("Head")
  18. local Torso = Character:FindFirstChild("Torso")
  19. local rArm = Character:FindFirstChild("Right Arm")
  20. local rShoulder = Torso:FindFirstChild("Right Shoulder")
  21. local Neck = Torso:FindFirstChild("Neck")
  22. local Weld, Current
  23. local NeckOriginal = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
  24. local ArmOriginal = CFrame.new(-1.4, 0.4, -1) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, 0)
  25. local ArmDrink = CFrame.new(0, -0.5, -1.3) * CFrame.fromEulerAnglesXYZ(math.rad(-130), math.rad(-20), math.rad(-60))
  26. local Mem = {
  27. NeckCF = CFrame.new(0, 0, 0)
  28. }
  29. function Lerp(A, B, C)
  30. return A + (B - A) * C
  31. end
  32. function Serp(A, B, C)
  33. local D = A:Dot(B)
  34. if D > 0.99999 or D < -0.99999 then
  35. return C <= 0.5 and A or B
  36. else
  37. local R = math.acos(D)
  38. return (A * math.sin((1 - C) * R) + B * math.sin(C * R)) / math.sin(R)
  39. end
  40. end
  41. function Merp(A, B, C)
  42. local AX, AY, AZ, A00, A01, A02, A10, A11, A12, A20, A21, A22 = A:components()
  43. local BX, BY, BZ, B00, B01, B02, B10, B11, B12, B20, B21, B22 = B:components()
  44. local V0 = Lerp(Vector3.new(AX, AY, AZ), Vector3.new(BX, BY, BZ), C)
  45. local V1 = Serp(Vector3.new(A00, A01, A02), Vector3.new(B00, B01, B02), C)
  46. local V2 = Serp(Vector3.new(A10, A11, A12), Vector3.new(B10, B11, B12), C)
  47. local V3 = Serp(Vector3.new(A20, A21, A22), Vector3.new(B20, B21, B22), C)
  48. return CFrame.new(V0.X, V0.Y, V0.Z, V1.X, V1.Y, V1.Z, V2.X, V2.Y, V2.Z, V3.X, V3.Y, V3.Z)
  49. end
  50. function Pitch(lookVector)
  51. return math.atan(lookVector.Y / math.sqrt(lookVector.X ^ 2 + lookVector.Z ^ 2))
  52. end
  53. function Run(F, ...)
  54. local A
  55. setfenv(F, setmetatable({
  56. wait = function(X)
  57. delay(X, function()
  58. if Current == A then
  59. coroutine.resume(A)
  60. end
  61. end)
  62. coroutine.yield()
  63. end
  64. }, {
  65. __index = getfenv(0)
  66. }))
  67. A = coroutine.create(F)
  68. Current = A
  69. coroutine.resume(Current, ...)
  70. end
  71. function Update(Mouse)
  72. local PitchMax = 0.1
  73. local YawMax = 0.2
  74. local NeckPitch = -Pitch(Mouse.Hit.lookVector)
  75. local NeckYaw = (Head.CFrame.p - Mouse.Hit.p).Unit:Cross(Torso.CFrame.lookVector).Y
  76. NeckPitch = NeckPitch / 5
  77. NeckYaw = NeckYaw / 5
  78. if PitchMax < NeckPitch then
  79. NeckPitch = PitchMax
  80. end
  81. if NeckPitch < -PitchMax then
  82. NeckPitch = -PitchMax
  83. end
  84. if YawMax < NeckYaw then
  85. NeckYaw = YawMax
  86. end
  87. if NeckYaw < -YawMax then
  88. NeckYaw = -YawMax
  89. end
  90. local NeckCF = NeckOriginal * CFrame.Angles(NeckPitch, 0, NeckYaw)
  91. Neck.C0 = Merp(Mem.NeckCF, NeckCF, 0.5)
  92. Mem.NeckCF = NeckCF
  93. end
  94. function Drink(Toggle)
  95. if Toggle then
  96. local Start = Weld.C1
  97. for i = 0, 1, 0.1 do
  98. Weld.C1 = Merp(Start, ArmDrink, i)
  99. wait()
  100. end
  101. if Handle:FindFirstChild("Drink") then
  102. if Handle.Drink.IsPlaying then
  103. Handle.Drink:Stop()
  104. end
  105. Handle.Drink:Play()
  106. end
  107. else
  108. if Handle:FindFirstChild("Drink") and Handle.Drink.IsPlaying then
  109. Handle.Drink:Stop()
  110. end
  111. local Start = Weld.C1
  112. for i = 0, 1, 0.1 do
  113. Weld.C1 = Merp(Start, ArmOriginal, i)
  114. wait()
  115. end
  116. end
  117. end
  118. Tool.Equipped:connect(function(Mouse)
  119. Equipped = true
  120. wait(0.1)
  121. rShoulder.Part1 = nil
  122. Weld = Instance.new("Weld", Head)
  123. Weld.Part0 = Head
  124. Weld.Part1 = rArm
  125. Weld.C1 = ArmOriginal
  126. wait(0.1)
  127. Mouse.Button1Down:connect(function()
  128. Run(Drink, true)
  129. end)
  130. Mouse.Button1Up:connect(function()
  131. Run(Drink, false)
  132. end)
  133. while Equipped do
  134. Update(Mouse)
  135. wait()
  136. end
  137. rShoulder.Part1 = Player.Character:FindFirstChild("Right Arm")
  138. Weld:Destroy()
  139. Neck.C0 = NeckOriginal
  140. end)
  141. Tool.Unequipped:connect(function(Mouse)
  142. Equipped = true
  143. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement