-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashscriptR.lua
84 lines (79 loc) · 2.08 KB
/
dashscriptR.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
--[[ Set the file here:
StarterPlayer/StarterCharacterScripts ]]--
local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Char = script.Parent
local HRP = Char:WaitForChild("HumanoidRootPart")
local debounce = false
local WKey = false
local AKey = false
local SKey = false
local DKey = false
Mouse.KeyDown:Connect(function(key)
if key == "w" then
WKey = true
elseif key == "a" then
AKey = true
elseif key == "s" then
SKey = true
elseif key == "d" then
DKey = true
end
end)
Mouse.KeyUp:Connect(function(key)
if key == "w" then
WKey = false
elseif key == "a" then
AKey = false
elseif key == "s" then
SKey = false
elseif key == "d" then
DKey = false
end
end)
UIS.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Q then
if WKey == true then
if debounce == false then
local vel = Instance.new("BodyVelocity", HRP)
vel.MaxForce = Vector3.new(math.huge,0,math.huge)
vel.Velocity = HRP.CFrame.LookVector*100
game.Debris:AddItem(vel,0.2)
debounce = true
wait(1)
debounce = false
end
elseif AKey == true then
if debounce == false then
local vel = Instance.new("BodyVelocity", HRP)
vel.MaxForce = Vector3.new(math.huge,0,math.huge)
vel.Velocity = HRP.CFrame.RightVector*-100
game.Debris:AddItem(vel,0.2)
debounce = true
wait(1)
debounce = false
end
elseif SKey == true then
if debounce == false then
local vel = Instance.new("BodyVelocity", HRP)
vel.MaxForce = Vector3.new(math.huge,0,math.huge)
vel.Velocity = HRP.CFrame.LookVector*-100
game.Debris:AddItem(vel,0.2)
debounce = true
wait(1)
debounce = false
end
elseif DKey == true then
if debounce == false then
local vel = Instance.new("BodyVelocity", HRP)
vel.MaxForce = Vector3.new(math.huge,0,math.huge)
vel.Velocity = HRP.CFrame.RightVector*100
game.Debris:AddItem(vel,0.2)
debounce = true
wait(1)
debounce = false
end
end
end
end)