if anyone is to lazy local uis = game:GetService("UserInputService") local player = game.Players.LocalPlayer local mouse = player:GetMouse() local char = player.Character or player.CharacterAdded:Wait() 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(input, gameProcessed) if gameProcessed then return end if input.KeyCode == Enum.KeyCode.E and not debounce then debounce = true local vel = Instance.new("BodyVelocity") vel.MaxForce = Vector3.new(math.huge, math.huge, math.huge) if Wkey then vel.Velocity = hrp.CFrame.LookVector * 100 elseif Akey then vel.Velocity = hrp.CFrame.RightVector * -100 elseif Skey then vel.Velocity = hrp.CFrame.RightVector * 100 else vel.Velocity = Vector3.new(0, 0, 0) end vel.Parent = hrp game.Debris:AddItem(vel, 0.2) wait(1) debounce = false end end)
@@unomasunohjnds your welcome also there is a little bit broken on the script but it's not that bad it still mostly works because I didn't fully follow the tutorial.
body velocity may be depricated but it works perfectly fine, it just doesn't work on attachments like the new systems do (at least this is what I have seen from a bit of research)
LinearVelocity has replaced it, although it's a bit broken, as when i used DevMelon's slide tutorial it started to fling my avatar whenever i tried to slide (which the solution to that was using roblox's new physics character controller.)
You need to provide the assest Id of your animations that you have published to Roblox, make sure you publish it as a group owned animation and not a animation created by you to avoid future complications. Hope this helps
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.E then if WKey == true then if debounce == false then local vel = Instance.new("BodyVelocity",HRP) vel.MaxForce = Vector3.new(math.huge,0,0,math.huge) vel.Velocity = HRP.CFrame.lookVector*100 game.Debris:AddItem(vel,.2) 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,0,math.huge) vel.Velocity = HRP.CFrame.RightVector*-100 game.Debris:AddItem(vel,.2) 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,0,math.huge) vel.Velocity = HRP.CFrame.LookVector*-100 game.Debris:AddItem(vel,.2) 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,0,math.huge) vel.Velocity = HRP.CFrame.RightVector*100 game.Debris:AddItem(vel,.2) wait(1) debounce = false end end end
Heres the full script 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, gameProcessedEvent) if gameProcessedEvent then return end -- Prevent action if the game processes the event if Key.KeyCode == Enum.KeyCode.E and not debounce then local vel = Instance.new("BodyVelocity") vel.MaxForce = Vector3.new(math.huge, 0, math.huge) if WKey then vel.Velocity = HRP.CFrame.LookVector * 100 elseif AKey then vel.Velocity = HRP.CFrame.RightVector * -100 elseif SKey then vel.Velocity = HRP.CFrame.LookVector * -100 elseif DKey then vel.Velocity = HRP.CFrame.RightVector * 100 end vel.Parent = HRP game.Debris:AddItem(vel, 0.2) debounce = true wait(1) debounce = false end end)
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.E then if WKey == true then if debounce == false then local vel = Instance.new("BodyVelocity",HRP) vel.MaxForce = Vector3.new(math.huge,0,0,math.huge) vel.Velocity = HRP.CFrame.lookVector*100 game.Debris:AddItem(vel,.2) 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,0,math.huge) vel.Velocity = HRP.CFrame.RightVector*-100 game.Debris:AddItem(vel,.2) 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,0,math.huge) vel.Velocity = HRP.CFrame.LookVector*-100 game.Debris:AddItem(vel,.2) 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,0,math.huge) vel.Velocity = HRP.CFrame.RightVector*100 game.Debris:AddItem(vel,.2) wait(1) debounce = false end end end
script 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(input, gameProcessed) if input.KeyCode == Enum.KeyCode.E then if WKey or AKey or SKey or DKey then if debounce == false then local vel = Instance.new("BodyVelocity", HRP) vel.MaxForce = Vector3.new(math.huge, 0, math.huge)
if WKey then vel.Velocity = HRP.CFrame.LookVector * 100 elseif AKey then vel.Velocity = -HRP.CFrame.RightVector * 100 elseif SKey then vel.Velocity = -HRP.CFrame.LookVector * 100 elseif DKey then vel.Velocity = HRP.CFrame.RightVector * 100 end
game.Debris:AddItem(vel, 0.2) debounce = true wait(0.5) debounce = false end end end end) Hope this help :)
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.C 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) Error :3: attempt to index nil with 'GetMouse' anywhere I made a mistake or typo?
if anyone is to lazy
local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local char = player.Character or player.CharacterAdded:Wait()
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(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.E and not debounce then
debounce = true
local vel = Instance.new("BodyVelocity")
vel.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
if Wkey then
vel.Velocity = hrp.CFrame.LookVector * 100
elseif Akey then
vel.Velocity = hrp.CFrame.RightVector * -100
elseif Skey then
vel.Velocity = hrp.CFrame.RightVector * 100
else
vel.Velocity = Vector3.new(0, 0, 0)
end
vel.Parent = hrp
game.Debris:AddItem(vel, 0.2)
wait(1)
debounce = false
end
end)
thanks
@@unomasunohjnds your welcome also there is a little bit broken on the script but it's not that bad it still mostly works because I didn't fully follow the tutorial.
0:49 bro's grades are better than mine
😭
THANKS U SO MUCH, I have did ur sword attack tutorial and it was very good,so thank u for this tutorial!🎉
You’re welcome!
Thank you broooo, u make it so simple i understand everything
Bro your intros are always fire, love it
Appreciate that
the only thing that could be a flaw in this is using body velocity since its depricated. But nice tutorial.
I guess
body velocity may be depricated but it works perfectly fine, it just doesn't work on attachments like the new systems do (at least this is what I have seen from a bit of research)
LinearVelocity has replaced it, although it's a bit broken, as when i used DevMelon's slide tutorial it started to fling my avatar whenever i tried to slide (which the solution to that was using roblox's new physics character controller.)
Hello Bro, your content is good, don't stop.👍
Thanks!
Nice vid it will help me alot
Glad I could help
Pretty new in coding (like new-born baby new) so how can i add my own animations in the dashes, plz help :)
You need to provide the assest Id of your animations that you have published to Roblox, make sure you publish it as a group owned animation and not a animation created by you to avoid future complications. Hope this helps
yeah, same issue
Nice video! BTW what does body velocity do?
It applies a force on the object
To move it
"Wow! AI just did the whole script for me, but im not lazy so-"
BUT I AMMMMMMM
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.E then
if WKey == true then
if debounce == false then
local vel = Instance.new("BodyVelocity",HRP)
vel.MaxForce = Vector3.new(math.huge,0,0,math.huge)
vel.Velocity = HRP.CFrame.lookVector*100
game.Debris:AddItem(vel,.2)
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,0,math.huge)
vel.Velocity = HRP.CFrame.RightVector*-100
game.Debris:AddItem(vel,.2)
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,0,math.huge)
vel.Velocity = HRP.CFrame.LookVector*-100
game.Debris:AddItem(vel,.2)
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,0,math.huge)
vel.Velocity = HRP.CFrame.RightVector*100
game.Debris:AddItem(vel,.2)
wait(1)
debounce = false
end
end
end
You make a couple typos in the script
@@devmelonrobloxcan u fix the script and resend the fixed script
@@Drxpyoutube at the start where you did local UIS instead of ; do :
Still didnt work
Says Workspace.guap4088.LocalScript:77: Expected ‘end’ (to close ‘function’ at line 36), got ; did you forget to close ‘then at line 66
thanks but what key do i press to dash?
E you can also change it at string 37 after "Enum.KeyCode.(your key)"
@@bacon_craft385 can you make it so you double tap space bar and how will it work for mobile users?
It doesn’t work😭
Tysm this work
How do i add an animation to the dash?
YESSS
YEAAAA
is there a way to attach a animation onto it, i am a starter scripter and this would help alot.
Can you make a boomerang weapon basicly a throw weapon that comes back
I sure might make a vid on this soon
It works but when i click s i dash to the right and when i click d nothing happens
how do i also apply animations to it? i want to make dashes with animations
i did everything step by step but script didnt work and nothings happening.
Do u get any errors
can you tell me what mic you use?
I use some random mic i found in my house i dont even know the name of it ahahah
I think its a Mackie em-usb
@@devmelonroblox love ur vids btw just added a dash system to my game
4:28
How can you modify this script to include an animation that plays when you dash in certain directions ?
When you add the bodyvelocity you do
anim = Humanoid:LoadAnimation(Animation)
anim:Play()
@@devmelonrobloxokay thank you :)
@@devmelonroblox erm it says unknown global humanoid and animation you think you could help me with that?
@@happyperkiness746hey did this work for you??
Does this work on the server side?¿
help! I did everything right but nothing happend what should i do?
@@Shernxuengoh then you didn’t do everything right check your output and tell me the error you get
How do you make it play an animation?
Does the game have to be R15 or R6?
no
@@Sakplayer Wdym by that?
@@sinadostewelde7317 I think you ask about the game should R15 or R6 to make dash system. Well it doesn't matter to have R15 or R6 to make dash
Bro is that for R6 too?
I'd assume so
Heres the full script
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, gameProcessedEvent)
if gameProcessedEvent then return end -- Prevent action if the game processes the event
if Key.KeyCode == Enum.KeyCode.E and not debounce then
local vel = Instance.new("BodyVelocity")
vel.MaxForce = Vector3.new(math.huge, 0, math.huge)
if WKey then
vel.Velocity = HRP.CFrame.LookVector * 100
elseif AKey then
vel.Velocity = HRP.CFrame.RightVector * -100
elseif SKey then
vel.Velocity = HRP.CFrame.LookVector * -100
elseif DKey then
vel.Velocity = HRP.CFrame.RightVector * 100
end
vel.Parent = HRP
game.Debris:AddItem(vel, 0.2)
debounce = true
wait(1)
debounce = false
end
end)
Why doesnt anything that i do from tutorials not work can u tell me why pls
Probably spelling mistakes like capital letters check your output for errors
can u give me the script so i dont have to write it down ;-; ? THANK U
Ppl do this so other ppl actually watch the video
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.E then
if WKey == true then
if debounce == false then
local vel = Instance.new("BodyVelocity",HRP)
vel.MaxForce = Vector3.new(math.huge,0,0,math.huge)
vel.Velocity = HRP.CFrame.lookVector*100
game.Debris:AddItem(vel,.2)
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,0,math.huge)
vel.Velocity = HRP.CFrame.RightVector*-100
game.Debris:AddItem(vel,.2)
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,0,math.huge)
vel.Velocity = HRP.CFrame.LookVector*-100
game.Debris:AddItem(vel,.2)
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,0,math.huge)
vel.Velocity = HRP.CFrame.RightVector*100
game.Debris:AddItem(vel,.2)
wait(1)
debounce = false
end
end
end
@@Lockin_Vrgt TYSMM
Redo how to make a worming sword jn Roblox
I have the same code but every time I press E and any other key it doesn’t work
you have to make an animation first
Did not work, also heck you for not having the code in the description!
It doesnt work and i have no errors
I have no clue how to do this I copied it exactly and only added a few lines to add my own animation and it doesn’t work 😭😭
u have to make an animation first
I't doesn't work for me
Can jou zet de script in de comments
isnt body vel deprecated
It worked in the video 🤔
can u put the script in the comments pls
Did not work ):
can some one post the script in comments?
Abouta see if it works
Did not work
You sure you wrote it right did u get any errorsv
@@devmelonrobloxI wrote it right
2nd😢
Nooooooooooo
script
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(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.E then
if WKey or AKey or SKey or DKey then
if debounce == false then
local vel = Instance.new("BodyVelocity", HRP)
vel.MaxForce = Vector3.new(math.huge, 0, math.huge)
if WKey then
vel.Velocity = HRP.CFrame.LookVector * 100
elseif AKey then
vel.Velocity = -HRP.CFrame.RightVector * 100
elseif SKey then
vel.Velocity = -HRP.CFrame.LookVector * 100
elseif DKey then
vel.Velocity = HRP.CFrame.RightVector * 100
end
game.Debris:AddItem(vel, 0.2)
debounce = true
wait(0.5)
debounce = false
end
end
end
end)
Hope this help :)
thx
JUST HAD ME WASTE MY TIME IT DIDNT WORK
Instead of saying it didn’t work say what actually didn’t work and what error you have so I could help
Skill issue
it doesnt work
What does work exactly saying it doesn’t work doesn’t help
Does this work on the server side?¿
do you mean would this work in a server script, or does it replicate to the server ?
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.C 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)
Error :3: attempt to index nil with 'GetMouse'
anywhere I made a mistake or typo?
W guy
you forgot the "=" when classifying HRP as the humanoid root part