Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- repeat wait() until game.Players.LocalPlayer.Character
- local Character = game.Players.LocalPlayer.Character
- local Humanoid = Character:WaitForChild("Humanoid")
- local UIS = game:GetService('UserInputService')
- local LastTapped,Tapped = false,false
- local Run = Humanoid:LoadAnimation(script:WaitForChild("Run"))
- local Mana,Trash = game.Players.LocalPlayer:WaitForChild("DataFolder").Mana, {}
- local TrailPart = game.ReplicatedStorage:WaitForChild("Effects").TrailPart
- local NotRun,Normal,ManaRun = 16,24,36
- local function CheckMana(Pass)
- if Pass then
- if Mana.Value == 0 then return end
- if Trash[Character] then return end
- if not LastTapped and not Tapped then return end
- local NewTrail = TrailPart:Clone(); NewTrail.Parent = workspace
- Trash[Character] = NewTrail
- Trash[Character].RunTrail.Enabled = true
- local WC = Instance.new("WeldConstraint",Trash[Character])
- WC.Part0 = Trash[Character]; WC.Part1 = Character.HumanoidRootPart
- Trash[Character].Position = Character.HumanoidRootPart.Position
- Humanoid.WalkSpeed = ManaRun
- else
- for _,v in pairs(Trash) do
- v:Destroy()
- end
- Trash[Character] = nil
- end
- end
- Mana.Changed:Connect(function()
- if Mana.Value == 0 then
- for _,v in pairs(Trash) do
- v:Destroy()
- end
- Trash[Character] = nil
- if LastTapped then Humanoid.WalkSpeed = Normal else Humanoid.WalkSpeed = NotRun end
- end
- end)
- UIS.InputBegan:Connect(function(Input, IsTyping)
- if IsTyping then return end
- if Input.KeyCode == Enum.KeyCode.W then
- if Tapped == false then
- Tapped = true
- else
- LastTapped = true
- Tapped = false
- Run:Play()
- Humanoid.WalkSpeed = Normal
- CheckMana(true)
- end
- delay(.4, function()
- if Tapped then
- Tapped = false
- end
- end)
- end
- end)
- UIS.InputEnded:Connect(function(Input, IsTyping)
- if IsTyping then return end
- if Input.KeyCode == Enum.KeyCode.W and LastTapped and not Tapped then
- Humanoid.WalkSpeed = NotRun
- CheckMana(false)
- Run:Stop()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement