Advertisement
Guest User

Untitled

a guest
Aug 16th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.83 KB | None | 0 0
  1. local player = game:GetService("Players").LocalPlayer;
  2. repeat wait() until player.Character;
  3. local character = player.Character;
  4. local h = character:WaitForChild("Humanoid");
  5. local UIS = game:GetService("UserInputService");
  6. local AnimationHandler = game:GetService("ReplicatedStorage"):WaitForChild("AnimationHandler");
  7.  
  8. local ready = h:LoadAnimation(script:WaitForChild("Ready"));
  9. local sit = h:LoadAnimation(script:WaitForChild("Sit"));
  10. local bow = h:LoadAnimation(script:WaitForChild("Bow"));
  11. local beg = h:LoadAnimation(script:WaitForChild("Beg"));
  12. local kneel = h:LoadAnimation(script:WaitForChild("Kneel"));
  13. local sleep = h:LoadAnimation(script:WaitForChild("Sleep"));
  14. local shove = h:LoadAnimation(script:WaitForChild("Shove"));
  15.  
  16. local readied = false;
  17. local sitting = false;
  18. local bowing = false;
  19. local begging = false;
  20. local kneeling = false;
  21. local sleeping = false;
  22. local shoving = false;
  23. local busy = false;
  24.  
  25. local kg = {
  26.     "Player1";
  27.     "HimaruXx";
  28.     "DrummerDude28";
  29.     "DatDoodRules";
  30.     "Lord_Annatar";
  31. };
  32.  
  33. function checkForTools()
  34.     for i,v in pairs(character:GetChildren()) do
  35.         if v:IsA("Tool") then
  36.             return true;
  37.         end;
  38.     end;
  39.     return false;
  40. end;
  41.  
  42. character.ChildAdded:connect(function(child)
  43.     if child:IsA("Tool") then
  44.         local animsPlaying = h:GetPlayingAnimationTracks();
  45.         for i,v in pairs(animsPlaying) do
  46.             if v.Name ~= "WalkAnim" and v.Name ~= "Hold" and v.Name ~= "Animation1" then
  47.                 v:Stop();
  48.             end;
  49.         end;
  50.         readied = false;
  51.         sitting = false;
  52.         bowing = false;
  53.         begging = false;
  54.         kneeling = false;
  55.         sleeping = false
  56.         busy = false;
  57.         if h.WalkSpeed < 16 then
  58.             h.WalkSpeed = 16;
  59.         end;
  60.     end;
  61. end);
  62.  
  63. UIS.InputBegan:connect(function(key, chatting)
  64.     if not chatting and not checkForTools() then
  65.        
  66.         if key.KeyCode == Enum.KeyCode.R then
  67.             if not busy and not readied then
  68.                 busy = true;
  69.                 readied = true;
  70.                 ready:Play();
  71.                 AnimationHandler:FireServer(1);
  72.             elseif busy and readied then
  73.                 AnimationHandler:FireServer(2);
  74.                 ready:Stop();
  75.                 readied = false;
  76.                 busy = false;
  77.             end;
  78.         end;
  79.        
  80.         if key.KeyCode == Enum.KeyCode.X then
  81.             if not busy and not sitting then
  82.                 h.WalkSpeed = 0
  83.                 busy = true;
  84.                 sitting = true;
  85.                 sit:Play();
  86.             elseif busy and sitting then
  87.                 h.WalkSpeed = 16
  88.                 sit:Stop();
  89.                 sitting = false;
  90.                 busy = false;
  91.             end;
  92.         end;
  93.        
  94.         if key.KeyCode == Enum.KeyCode.B then
  95.             if not busy and not bowing then
  96.                 h.WalkSpeed = 0
  97.                 busy = true;
  98.                 bowing = true;
  99.                 bow:Play();
  100.             elseif busy and bowing then
  101.                 h.WalkSpeed = 16
  102.                 bow:Stop();
  103.                 bowing = false;
  104.                 busy = false;
  105.             end;
  106.         end;
  107.        
  108.         if key.KeyCode == Enum.KeyCode.N then
  109.             if not busy and not begging then
  110.                 h.WalkSpeed = 0
  111.                 busy = true;
  112.                 begging = true;
  113.                 beg:Play();
  114.             elseif busy and begging then
  115.                 h.WalkSpeed = 16
  116.                 beg:Stop();
  117.                 begging = false;
  118.                 busy = false;
  119.             end;
  120.         end;
  121.        
  122.         if key.KeyCode == Enum.KeyCode.C then
  123.             if not busy and not kneeling then
  124.                 h.WalkSpeed = 0
  125.                 busy = true;
  126.                 kneeling = true;
  127.                 kneel:Play();
  128.             elseif busy and kneeling then
  129.                 h.WalkSpeed = 16
  130.                 kneel:Stop();
  131.                 kneeling = false;
  132.                 busy = false;
  133.             end;
  134.         end;
  135.        
  136.         if key.KeyCode == Enum.KeyCode.V then
  137.             if not busy and not sleeping then
  138.                 h.WalkSpeed = 0;
  139.                 busy = true;
  140.                 sleeping = true;
  141.                 sleep:Play()
  142.             elseif busy and sleeping then
  143.                 h.WalkSpeed = 16;
  144.                 sleep:Stop();
  145.                 sleeping = false;
  146.                 busy = false;
  147.             end;
  148.         end;
  149.        
  150.         if key.KeyCode == Enum.KeyCode.Z then
  151.             for i,v in pairs(kg) do
  152.                 if v:lower() == player.Name:lower() then
  153.                     if not busy and not shoving then
  154.                         busy, shoving = true, true;
  155.                         shove:Play();
  156.                         AnimationHandler:FireServer(3);
  157.                         wait(1);
  158.                         busy, shoving = false, false;
  159.                     end;
  160.                 end;
  161.             end;
  162.         end;
  163.        
  164.     end;
  165. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement