-- getting services
local UIS = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local char = script.Parent -- in our character
local humanoid = char:WaitForChild("HumanoidRootPart")
local debounce = false -- cd
-- getting keys
local aKey = false
local dKey = false
mouse.KeyDown:Connect(function(key)
if key == "a" then
aKey = true
elseif key == "d" then
dKey = false
end
end)
mouse.KeyUp:Connect(function(key)
if key == "a" then
aKey = true
elseif key == "d" then
dKey = false
end
end)
UIS.InputBegan:Connect(function(key, gpe)
if gpe then return end
if key.KeyCode == Enum.KeyCode.Q then
if aKey == true then
if debounce == false then
local velocity = Instance.new("BodyVelocity", humanoid)
velocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
velocity.Velocity = humanoid.CFrame.RightVector*-100
game.Debris:AddItem(velocity, 0.2)
print("dashleft")
debounce = true
wait(1)
debounce = false
end
elseif dKey == true then
if debounce == false then
local velocity = Instance.new("BodyVelocity", humanoid)
velocity.MaxForce = Vector3.new(math.huge,0,math.huge)
velocity.Velocity = humanoid.CFrame.RightVector*100
game.Debris:AddItem(velocity, 0.2)
print("dashRight")
debounce = true
wait(1)
debounce = false
end
end
end
end)
** You are now Level 4! **