Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --SynapseX Decompiler
- local Tool = script.Parent
- local Handle = Tool:FindFirstChild("Handle")
- local Equipped = true
- local Player = game.Players.LocalPlayer
- repeat
- wait()
- until Player.Character
- wait()
- local Character = Player.Character
- repeat
- wait()
- until Character:FindFirstChild("Humanoid")
- wait()
- local Humanoid = Character:FindFirstChild("Humanoid")
- local Head = Character:FindFirstChild("Head")
- local Torso = Character:FindFirstChild("Torso")
- local rArm = Character:FindFirstChild("Right Arm")
- local rShoulder = Torso:FindFirstChild("Right Shoulder")
- local Neck = Torso:FindFirstChild("Neck")
- local Weld, Current
- local NeckOriginal = CFrame.new(0, 1, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
- local ArmOriginal = CFrame.new(-1.4, 0.4, -1) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, 0)
- local ArmDrink = CFrame.new(0, -0.5, -1.3) * CFrame.fromEulerAnglesXYZ(math.rad(-130), math.rad(-20), math.rad(-60))
- local Mem = {
- NeckCF = CFrame.new(0, 0, 0)
- }
- function Lerp(A, B, C)
- return A + (B - A) * C
- end
- function Serp(A, B, C)
- local D = A:Dot(B)
- if D > 0.99999 or D < -0.99999 then
- return C <= 0.5 and A or B
- else
- local R = math.acos(D)
- return (A * math.sin((1 - C) * R) + B * math.sin(C * R)) / math.sin(R)
- end
- end
- function Merp(A, B, C)
- local AX, AY, AZ, A00, A01, A02, A10, A11, A12, A20, A21, A22 = A:components()
- local BX, BY, BZ, B00, B01, B02, B10, B11, B12, B20, B21, B22 = B:components()
- local V0 = Lerp(Vector3.new(AX, AY, AZ), Vector3.new(BX, BY, BZ), C)
- local V1 = Serp(Vector3.new(A00, A01, A02), Vector3.new(B00, B01, B02), C)
- local V2 = Serp(Vector3.new(A10, A11, A12), Vector3.new(B10, B11, B12), C)
- local V3 = Serp(Vector3.new(A20, A21, A22), Vector3.new(B20, B21, B22), C)
- 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)
- end
- function Pitch(lookVector)
- return math.atan(lookVector.Y / math.sqrt(lookVector.X ^ 2 + lookVector.Z ^ 2))
- end
- function Run(F, ...)
- local A
- setfenv(F, setmetatable({
- wait = function(X)
- delay(X, function()
- if Current == A then
- coroutine.resume(A)
- end
- end)
- coroutine.yield()
- end
- }, {
- __index = getfenv(0)
- }))
- A = coroutine.create(F)
- Current = A
- coroutine.resume(Current, ...)
- end
- function Update(Mouse)
- local PitchMax = 0.1
- local YawMax = 0.2
- local NeckPitch = -Pitch(Mouse.Hit.lookVector)
- local NeckYaw = (Head.CFrame.p - Mouse.Hit.p).Unit:Cross(Torso.CFrame.lookVector).Y
- NeckPitch = NeckPitch / 5
- NeckYaw = NeckYaw / 5
- if PitchMax < NeckPitch then
- NeckPitch = PitchMax
- end
- if NeckPitch < -PitchMax then
- NeckPitch = -PitchMax
- end
- if YawMax < NeckYaw then
- NeckYaw = YawMax
- end
- if NeckYaw < -YawMax then
- NeckYaw = -YawMax
- end
- local NeckCF = NeckOriginal * CFrame.Angles(NeckPitch, 0, NeckYaw)
- Neck.C0 = Merp(Mem.NeckCF, NeckCF, 0.5)
- Mem.NeckCF = NeckCF
- end
- function Drink(Toggle)
- if Toggle then
- local Start = Weld.C1
- for i = 0, 1, 0.1 do
- Weld.C1 = Merp(Start, ArmDrink, i)
- wait()
- end
- if Handle:FindFirstChild("Drink") then
- if Handle.Drink.IsPlaying then
- Handle.Drink:Stop()
- end
- Handle.Drink:Play()
- end
- else
- if Handle:FindFirstChild("Drink") and Handle.Drink.IsPlaying then
- Handle.Drink:Stop()
- end
- local Start = Weld.C1
- for i = 0, 1, 0.1 do
- Weld.C1 = Merp(Start, ArmOriginal, i)
- wait()
- end
- end
- end
- Tool.Equipped:connect(function(Mouse)
- Equipped = true
- wait(0.1)
- rShoulder.Part1 = nil
- Weld = Instance.new("Weld", Head)
- Weld.Part0 = Head
- Weld.Part1 = rArm
- Weld.C1 = ArmOriginal
- wait(0.1)
- Mouse.Button1Down:connect(function()
- Run(Drink, true)
- end)
- Mouse.Button1Up:connect(function()
- Run(Drink, false)
- end)
- while Equipped do
- Update(Mouse)
- wait()
- end
- rShoulder.Part1 = Player.Character:FindFirstChild("Right Arm")
- Weld:Destroy()
- Neck.C0 = NeckOriginal
- end)
- Tool.Unequipped:connect(function(Mouse)
- Equipped = true
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement