Advertisement
SxScripting

ManaRun Local Script[2021]

Aug 11th, 2021
834
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. repeat wait() until game.Players.LocalPlayer.Character
  2.  
  3. local Character = game.Players.LocalPlayer.Character
  4. local Humanoid = Character:WaitForChild("Humanoid")
  5. local UIS = game:GetService('UserInputService')
  6. local LastTapped,Tapped = false,false
  7. local Run = Humanoid:LoadAnimation(script:WaitForChild("Run"))
  8. local Mana,Trash = game.Players.LocalPlayer:WaitForChild("DataFolder").Mana, {}
  9. local TrailPart = game.ReplicatedStorage:WaitForChild("Effects").TrailPart
  10. local NotRun,Normal,ManaRun = 16,24,36
  11.  
  12. local function CheckMana(Pass)
  13. if Pass then
  14. if Mana.Value == 0 then return end
  15. if Trash[Character] then return end
  16. if not LastTapped and not Tapped then return end
  17. local NewTrail = TrailPart:Clone(); NewTrail.Parent = workspace
  18. Trash[Character] = NewTrail
  19. Trash[Character].RunTrail.Enabled = true
  20. local WC = Instance.new("WeldConstraint",Trash[Character])
  21. WC.Part0 = Trash[Character]; WC.Part1 = Character.HumanoidRootPart
  22. Trash[Character].Position = Character.HumanoidRootPart.Position
  23. Humanoid.WalkSpeed = ManaRun
  24. else
  25. for _,v in pairs(Trash) do
  26. v:Destroy()
  27. end
  28. Trash[Character] = nil
  29. end
  30. end
  31.  
  32. Mana.Changed:Connect(function()
  33. if Mana.Value == 0 then
  34. for _,v in pairs(Trash) do
  35. v:Destroy()
  36. end
  37. Trash[Character] = nil
  38. if LastTapped then Humanoid.WalkSpeed = Normal else Humanoid.WalkSpeed = NotRun end
  39. end
  40. end)
  41.  
  42. UIS.InputBegan:Connect(function(Input, IsTyping)
  43. if IsTyping then return end
  44. if Input.KeyCode == Enum.KeyCode.W then
  45. if Tapped == false then
  46. Tapped = true
  47. else
  48. LastTapped = true
  49. Tapped = false
  50. Run:Play()
  51. Humanoid.WalkSpeed = Normal
  52. CheckMana(true)
  53. end
  54.  
  55. delay(.4, function()
  56. if Tapped then
  57. Tapped = false
  58. end
  59. end)
  60.  
  61. end
  62. end)
  63.  
  64. UIS.InputEnded:Connect(function(Input, IsTyping)
  65. if IsTyping then return end
  66. if Input.KeyCode == Enum.KeyCode.W and LastTapped and not Tapped then
  67. Humanoid.WalkSpeed = NotRun
  68. CheckMana(false)
  69. Run:Stop()
  70. end
  71. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement