Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Player = owner
- local Character = Player.Character
- local HumanoidRP = Character:WaitForChild("HumanoidRootPart")
- local UIS = game:GetService("UserInputService")
- local Mouse = Player:GetMouse()
- local TapTime = .25
- local Tapped = false
- local Toggle = false
- UIS.InputBegan:Connect(function(Input)
- if Input.KeyCode == Enum.KeyCode.Space then
- if not Tapped then
- Tapped = true
- wait(TapTime)
- Tapped = false
- else
- if Toggle == false then
- local Jump = Instance.new("BodyVelocity",HumanoidRP)
- Jump.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- Jump.Velocity = Vector3.new(0, 50, 0)
- game.Debris:AddItem(Jump, .5)
- wait(.5)
- HumanoidRP.Anchored = true
- Toggle = true
- elseif Toggle == true then
- Toggle = false
- HumanoidRP.Anchored = false
- local Children = HumanoidRP:GetChildren()
- for i,child in pairs (Children) do
- if child:IsA("BodyVelocity") then
- child:Destroy()
- end
- end
- end
- end
- end
- end)
- UIS.InputBegan:Connect(function(Input)
- if Input.KeyCode == Enum.KeyCode.W then
- if Toggle == false then return end
- HumanoidRP.Anchored = false
- if HumanoidRP:FindFirstChildOfClass("BodyVelocity") then
- HumanoidRP:FindFirstChildOfClass("BodyVelocity"):Destroy()
- end
- local Forward = Instance.new("BodyVelocity",HumanoidRP)
- Forward.Name = "ForwardMovement"
- Forward.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- while Toggle == true do
- Forward.Velocity = Mouse.Hit.lookVector*150
- wait()
- end
- end
- if Input.KeyCode == Enum.KeyCode.S then
- if Toggle == false then return end
- HumanoidRP.Anchored = false
- if HumanoidRP:FindFirstChildOfClass("BodyVelocity") then
- HumanoidRP:FindFirstChildOfClass("BodyVelocity"):Destroy()
- end
- local Forward = Instance.new("BodyVelocity",HumanoidRP)
- Forward.Name = "ForwardMovement"
- Forward.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- while Toggle == true do
- Forward.Velocity = Mouse.Hit.lookVector*-150
- wait()
- end
- end
- if Input.KeyCode == Enum.KeyCode.D then
- if Toggle == false then return end
- HumanoidRP.Anchored = false
- if HumanoidRP:FindFirstChildOfClass("BodyVelocity") then
- HumanoidRP:FindFirstChildOfClass("BodyVelocity"):Destroy()
- end
- local Forward = Instance.new("BodyVelocity",HumanoidRP)
- Forward.Name = "ForwardMovement"
- Forward.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- while Toggle == true do
- Forward.Velocity = Mouse.Hit.lookVector + Vector3.new(150, 0, 0)
- wait()
- end
- end
- if Input.KeyCode == Enum.KeyCode.A then
- if Toggle == false then return end
- HumanoidRP.Anchored = false
- if HumanoidRP:FindFirstChildOfClass("BodyVelocity") then
- HumanoidRP:FindFirstChildOfClass("BodyVelocity"):Destroy()
- end
- local Forward = Instance.new("BodyVelocity",HumanoidRP)
- Forward.Name = "ForwardMovement"
- Forward.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- while Toggle == true do
- Forward.Velocity = Mouse.Hit.lookVector + Vector3.new(-150, 0, 0)
- wait()
- end
- end
- end)
- UIS.InputEnded:Connect(function(Input)
- if Input.KeyCode == Enum.KeyCode.W then
- if HumanoidRP:FindFirstChild("ForwardMovement") then
- HumanoidRP.ForwardMovement:Destroy()
- HumanoidRP.Anchored = true
- end
- end
- if Input.KeyCode == Enum.KeyCode.S then
- if HumanoidRP:FindFirstChild("ForwardMovement") then
- HumanoidRP.ForwardMovement:Destroy()
- HumanoidRP.Anchored = true
- end
- end
- if Input.KeyCode == Enum.KeyCode.D then
- if HumanoidRP:FindFirstChild("ForwardMovement") then
- HumanoidRP.ForwardMovement:Destroy()
- HumanoidRP.Anchored = true
- end
- end
- if Input.KeyCode == Enum.KeyCode.A then
- if HumanoidRP:FindFirstChild("ForwardMovement") then
- HumanoidRP.ForwardMovement:Destroy()
- HumanoidRP.Anchored = true
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement