Guest_1302

Guest 1337 moveset script

May 2nd, 2025 (edited)
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.58 KB | Source Code | 0 0
  1. -- half made by gpt cuz of errors xd
  2. -- sprint
  3. workspace.Camera.FieldOfView = 85
  4. local Player = game:GetService("Players").LocalPlayer
  5. local UserInputService = game:GetService("UserInputService")
  6. local RunService = game:GetService("RunService")
  7.  
  8. -- configuration
  9. local SPRINT_KEY = Enum.KeyCode.LeftShift
  10. local SPRINT_SPEED_MULTIPLIER = 1.3
  11. local MAX_STAMINA = 100
  12. local STAMINA_DEPLETION_RATE = 10 -- per sec
  13. local STAMINA_REGENERATION_RATE = 20
  14. local COOLDOWN_DURATION = 3
  15.  
  16. -- variables
  17. local stamina = MAX_STAMINA
  18. local isSprinting = false
  19. local isCooldown = false
  20. local lastUpdate = os.clock()
  21. local humanoid
  22. local baseWalkSpeed
  23. local AnimRuninTrack
  24. local connections = {}
  25.  
  26. -- GUI
  27. local gui = Instance.new("ScreenGui")
  28. gui.Name = "StaminaGUI"
  29. gui.Parent = Player:WaitForChild("PlayerGui")
  30.  
  31. local frame = Instance.new("Frame")
  32. frame.Size = UDim2.new(0.2, 0, 0.03, 0)
  33. frame.Position = UDim2.new(0.1, 0, 0.9, 0)
  34. frame.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  35. frame.BorderSizePixel = 2
  36. frame.BorderColor3 = Color3.fromRGB(20, 20, 20)
  37. frame.Parent = gui
  38.  
  39. local bar = Instance.new("Frame")
  40. bar.Size = UDim2.new(1, 0, 1, 0)
  41. bar.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  42. bar.BorderSizePixel = 0
  43. bar.Parent = frame
  44.  
  45. local textLabel = Instance.new("TextLabel")
  46. textLabel.Size = UDim2.new(1, 0, 1, 0)
  47. textLabel.BackgroundTransparency = 1
  48. textLabel.Text = "Stamina: 100%"
  49. textLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
  50. textLabel.Font = Enum.Font.SourceSansBold
  51. textLabel.TextSize = 14
  52. textLabel.Parent = frame
  53.  
  54. -- Cleanup function
  55. local function cleanup()
  56.     -- Disconnect all connections
  57.     for _, connection in pairs(connections) do
  58.         connection:Disconnect()
  59.     end
  60.     connections = {}
  61.  
  62.     -- Stop and clean up animation
  63.     if AnimRuninTrack then
  64.         AnimRuninTrack:Stop()
  65.         AnimRuninTrack:Destroy()
  66.         AnimRuninTrack = nil
  67.     end
  68.    
  69.     -- Reset variables
  70.     isSprinting = false
  71.     humanoid = nil
  72. end
  73.  
  74. --update GUI
  75. local function updateGUI()
  76.     local percentage = math.floor((stamina / MAX_STAMINA) * 100)
  77.     bar.Size = UDim2.new(stamina / MAX_STAMINA, 0, 1, 0)
  78.     textLabel.Text = "Stamina: " .. percentage .. "%"
  79. end
  80.  
  81. -- Initialize character
  82. local function setupCharacter(character)
  83.     -- Clean up previous character
  84.     cleanup()
  85.    
  86.     humanoid = character:WaitForChild("Humanoid")
  87.     baseWalkSpeed = humanoid.WalkSpeed
  88.    
  89.     -- Create animation track
  90.     local AnimRunin = Instance.new("Animation")
  91.     AnimRunin.AnimationId = "rbxassetid://204328711"
  92.     AnimRuninTrack = humanoid:LoadAnimation(AnimRunin)
  93.    
  94.     -- Reset state
  95.     isSprinting = false
  96.     stamina = MAX_STAMINA
  97.     isCooldown = false
  98.     updateGUI()
  99.    
  100.     -- Handle death
  101.     table.insert(connections, humanoid.Died:Connect(function()
  102.         cleanup() -- This will completely disable the script
  103.     end))
  104.    
  105.     -- Clean up when character is removed
  106.     table.insert(connections, character:GetPropertyChangedSignal("Parent"):Connect(function()
  107.         if not character.Parent then
  108.             cleanup()
  109.         end
  110.     end))
  111. end
  112.  
  113. -- Set up connections
  114. table.insert(connections, Player.CharacterAdded:Connect(setupCharacter))
  115. if Player.Character then
  116.     setupCharacter(Player.Character)
  117. end
  118.  
  119. table.insert(connections, UserInputService.InputBegan:Connect(function(input, gameProcessed)
  120.     if gameProcessed then return end
  121.    
  122.     if input.KeyCode == SPRINT_KEY and humanoid and not isCooldown and stamina > 10 then
  123.         if humanoid:GetState() ~= Enum.HumanoidStateType.Climbing then
  124.             if AnimRuninTrack then
  125.                 AnimRuninTrack:Play(0.1, 0.1, 0)
  126.                 AnimRuninTrack:AdjustSpeed(2.5)
  127.             end
  128.             isSprinting = true
  129.             humanoid.WalkSpeed = baseWalkSpeed * SPRINT_SPEED_MULTIPLIER
  130.         end
  131.     end
  132. end))
  133.  
  134. table.insert(connections, UserInputService.InputEnded:Connect(function(input, gameProcessed)
  135.     if input.KeyCode == SPRINT_KEY and isSprinting then
  136.         if humanoid then
  137.             if AnimRuninTrack then
  138.                 AnimRuninTrack:Stop()
  139.             end
  140.             humanoid.WalkSpeed = baseWalkSpeed
  141.         end
  142.         isSprinting = false
  143.     end
  144. end))
  145.  
  146. table.insert(connections, RunService.Heartbeat:Connect(function()
  147.     local now = os.clock()
  148.     local deltaTime = now - lastUpdate
  149.     lastUpdate = now
  150.    
  151.     if not humanoid then
  152.         isSprinting = false
  153.         return
  154.     end
  155.    
  156.     if isSprinting then
  157.         stamina = math.max(0, stamina - STAMINA_DEPLETION_RATE * deltaTime)
  158.        
  159.         if stamina <= 0 then
  160.             isSprinting = false
  161.             isCooldown = true
  162.             humanoid.WalkSpeed = baseWalkSpeed
  163.             if AnimRuninTrack then
  164.                 AnimRuninTrack:Stop()
  165.             end
  166.             task.delay(COOLDOWN_DURATION, function()
  167.                 isCooldown = false
  168.             end)
  169.         end
  170.     else
  171.         if not isCooldown then
  172.             stamina = math.min(MAX_STAMINA, stamina + STAMINA_REGENERATION_RATE * deltaTime)
  173.         end
  174.     end
  175.    
  176.     updateGUI()
  177. end))
  178.  
  179. -- Charge Ability
  180. local UserInputService = game:GetService("UserInputService")
  181. local Players = game:GetService("Players")
  182.  
  183. local player = Players.LocalPlayer
  184. local chargeConnection
  185. local ChargeAnimTrack
  186. local isChargeAnimPlaying = false
  187. local scriptActive = true
  188.  
  189. local function setupCharacter(character)
  190.     if not scriptActive then return end
  191.    
  192.     -- delete anims
  193.     if chargeConnection then
  194.         chargeConnection:Disconnect()
  195.         chargeConnection = nil
  196.     end
  197.    
  198.     local humanoid = character:WaitForChild("Humanoid")
  199.    
  200.     local ChargeAnim = Instance.new("Animation")
  201.     ChargeAnim.AnimationId = "rbxassetid://218504594"
  202.     ChargeAnimTrack = humanoid:LoadAnimation(ChargeAnim)
  203.    
  204.     chargeConnection = UserInputService.InputBegan:Connect(function(input, gameProcessed)
  205.         if not scriptActive then return end
  206.         if not gameProcessed and input.KeyCode == Enum.KeyCode.E then
  207.            
  208.             isChargeAnimPlaying = not isChargeAnimPlaying
  209.            
  210.             if isChargeAnimPlaying then
  211.                 for _, track in pairs(humanoid:GetPlayingAnimationTracks()) do
  212.                     track:Stop()
  213.                 end
  214.                 ChargeAnimTrack:Play()
  215.                 ChargeAnimTrack.TimePosition = 0.25
  216.                 ChargeAnimTrack:AdjustSpeed(0)
  217.                 humanoid.WalkSpeed = 22
  218.                 workspace.Camera.FieldOfView = 65
  219.             else
  220.                 ChargeAnimTrack:AdjustSpeed(1)
  221.                 task.wait(0.1)
  222.                 humanoid.WalkSpeed = 16
  223.                 ChargeAnimTrack:Stop()
  224.                 workspace.Camera.FieldOfView = 85
  225.             end
  226.         end
  227.     end)
  228. end
  229.  
  230. local punchConnection
  231. local PunchAnimTrack
  232. local isPunchAnimPlaying = false
  233.  
  234. local function setupPunchAbility(character)
  235.     if not scriptActive then return end
  236.    
  237.     if punchConnection then
  238.         punchConnection:Disconnect()
  239.         punchConnection = nil
  240.     end
  241.    
  242.     local humanoid = character:WaitForChild("Humanoid")
  243.     local rootPart = character:WaitForChild("HumanoidRootPart")
  244.    
  245.     local PunchAnim = Instance.new("Animation")
  246.     PunchAnim.AnimationId = "rbxassetid://204062532"
  247.     PunchAnimTrack = humanoid:LoadAnimation(PunchAnim)
  248.    
  249.     punchConnection = UserInputService.InputBegan:Connect(function(input, gameProcessed)
  250.         if not scriptActive then return end
  251.         if not gameProcessed and input.KeyCode == Enum.KeyCode.R and not isPunchAnimPlaying then
  252.             isPunchAnimPlaying = true
  253.            
  254.             for _, track in pairs(humanoid:GetPlayingAnimationTracks()) do
  255.                 track:Stop()
  256.             end
  257.            
  258.             PunchAnimTrack:Play()
  259.             PunchAnimTrack:AdjustSpeed(0.25)
  260.             humanoid.WalkSpeed = 4
  261.            
  262.             wait(0.6)
  263.            
  264.             -- move forward thing
  265.             local direction = rootPart.CFrame.LookVector
  266.             local punchForce = 100
  267.             rootPart.AssemblyLinearVelocity = direction * punchForce
  268.            
  269.             PunchAnimTrack:AdjustSpeed(2)
  270.             humanoid.WalkSpeed = 16
  271.            
  272.             PunchAnimTrack.Stopped:Wait()
  273.             isPunchAnimPlaying = false
  274.         end
  275.     end)
  276. end
  277.  
  278. -- Block Ability
  279. local BlockConnection
  280. local BlockAnimTrack
  281. local isBlocking = false
  282.  
  283. local function setupBlockAbility(character)
  284.     if not scriptActive then return end
  285.    
  286.     if BlockConnection then
  287.         BlockConnection:Disconnect()
  288.         BlockConnection = nil
  289.     end
  290.    
  291.     local humanoid = character:WaitForChild("Humanoid")
  292.    
  293.     if not BlockAnimTrack then
  294.         local BlockAnim = Instance.new("Animation")
  295.         BlockAnim.AnimationId = "rbxassetid://242455877"
  296.         BlockAnimTrack = humanoid:LoadAnimation(BlockAnim)
  297.     end
  298.    
  299.     BlockConnection = UserInputService.InputBegan:Connect(function(input, gameProcessed)
  300.         if not scriptActive then return end
  301.         if gameProcessed or isBlocking then return end
  302.         if input.KeyCode ~= Enum.KeyCode.Q then return end
  303.        
  304.         isBlocking = true
  305.        
  306.         for _, track in pairs(humanoid:GetPlayingAnimationTracks()) do
  307.             track:Stop()
  308.         end
  309.        
  310.         BlockAnimTrack:Play()
  311.         BlockAnimTrack:AdjustSpeed(0)
  312.         BlockAnimTrack.TimePosition = 0.41
  313.         humanoid.WalkSpeed = 4
  314.        
  315.         local function endBlock()
  316.             humanoid.WalkSpeed = 16
  317.             BlockAnimTrack:AdjustSpeed(1)
  318.             BlockAnimTrack:Stop()
  319.             isBlocking = false
  320.         end
  321.        
  322.         local blockEnd = Instance.new("BindableEvent")
  323.         blockEnd.Event:Connect(endBlock)
  324.        
  325.         delay(1, function()
  326.             if isBlocking then
  327.                 blockEnd:Fire()
  328.             end
  329.         end)
  330.        
  331.         BlockAnimTrack.Stopped:Connect(function()
  332.             if isBlocking then
  333.                 blockEnd:Fire()
  334.             end
  335.         end)
  336.     end)
  337. end
  338. -- Function to deactivate the script
  339. local function deactivateScript()
  340.     scriptActive = false
  341.     if chargeConnection then
  342.         chargeConnection:Disconnect()
  343.         chargeConnection = nil
  344.     end
  345.     if punchConnection then
  346.         punchConnection:Disconnect()
  347.         punchConnection = nil
  348.     end
  349.     if BlockConnection then
  350.         BlockConnection:Disconnect()
  351.         BlockConnection = nil
  352.     end
  353.     if ChargeAnimTrack then
  354.         ChargeAnimTrack:Stop()
  355.         ChargeAnimTrack = nil
  356.     end
  357.     if PunchAnimTrack then
  358.         PunchAnimTrack:Stop()
  359.         PunchAnimTrack = nil
  360.     end
  361.     if BlockAnimTrack then
  362.         BlockAnimTrack:Stop()
  363.         BlockAnimTrack = nil
  364.     end
  365.     isChargeAnimPlaying = false
  366.     isPunchAnimPlaying = false
  367.     isBlockAnimPlaying = false
  368. end
  369.  
  370. if player.Character then
  371.     setupCharacter(player.Character)
  372.     setupPunchAbility(player.Character)
  373.     setupBlockAbility(player.Character)
  374. end
  375.  
  376. player.CharacterAdded:Connect(function(character)
  377.     if scriptActive then
  378.         setupCharacter(character)
  379.         setupPunchAbility(character)
  380.         setupBlockAbility(character)
  381.     end
  382. end)
  383.  
  384. player.CharacterRemoving:Connect(function()
  385.     deactivateScript()
  386. end)
  387.  
  388. game.Destroying:Connect(function()
  389.     deactivateScript()
  390. end)
  391.  
  392. --notify
  393.     local Callback = Instance.new("BindableFunction")
  394.     function Callback.OnInvoke(Button)
  395.     end
  396.  
  397.     -- create and play a sound
  398.     local sound = Instance.new("Sound")
  399.     sound.SoundId = "rbxassetid://135478009117226"
  400.     sound.Parent = game:GetService("Workspace")
  401.     sound.Volume = 0.5
  402.     sound:Play()
  403.  
  404.     --notification
  405.     game:GetService("StarterGui"):SetCore("SendNotification", {
  406.     Title = "Guest 1337 moveset",
  407.     Text = "Script Activated. Enjoy! :)\n(resets when u die)",
  408.     Icon = "",
  409.     Duration = 5,
  410.     Callback = Callback,
  411.     Button1 = "OK",
  412.     })
  413.  
  414.     sound.Ended:Connect(function()
  415.     sound:Destroy()
  416.     end)
  417.     Callback:Destroy()
  418. --notify
  419.     local Callback = Instance.new("BindableFunction")
  420.     function Callback.OnInvoke(Button)
  421.     end
  422.  
  423.     -- create and play a sound
  424.     local sound = Instance.new("Sound")
  425.     sound.SoundId = "rbxassetid://135478009117226"
  426.     sound.Parent = game:GetService("Workspace")
  427.     sound.Volume = 0.5
  428.     sound:Play()
  429.  
  430.     --notification
  431.     game:GetService("StarterGui"):SetCore("SendNotification", {
  432.     Title = "Guest 1337 moveset",
  433.     Text = "(Q - Block)\n(E - Charge)\n(R - Punch)",
  434.     Icon = "",
  435.     Duration = 10,
  436.     Callback = Callback,
  437.     Button1 = "OK",
  438.     })
  439.  
  440.     sound.Ended:Connect(function()
  441.     sound:Destroy()
  442.     end)
  443.     Callback:Destroy()
  444.  
Tags: Roblox
Advertisement
Add Comment
Please, Sign In to add comment