#W+A and S+A combinations not working with my Q to dash
1 messages · Page 1 of 1 (latest)
-- [CLIENT] --> Shared to all clients
--> Services
local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Debris = game:GetService("Debris")
--> References
local LocalPlayer = Players.LocalPlayer
local SFX = require(ReplicatedStorage.Modules.Shared.SFX)
--> Configuration
local GlobalKeybinds = {
MakeInputButton = true,
CustomText = "Q",
Priority = 2,
Icon = nil,
MakeClickSound = false,
CanPress = true,
ActivateCooldownWhenLetGo = false,
Cooldown = 1,
Key = "Q",
}
GlobalKeybinds.Disabled = false
function GlobalKeybinds:RequestValidation(Player)
return UIS:IsKeyDown(Enum.KeyCode.W)
or UIS:IsKeyDown(Enum.KeyCode.A)
or UIS:IsKeyDown(Enum.KeyCode.S)
or UIS:IsKeyDown(Enum.KeyCode.D)
end
function GlobalKeybinds:OnActivated(Player)
local Char = Player.Character
local Tor = Char and Char:FindFirstChild("Torso")
local Hum = Char and Char:FindFirstChildOfClass("Humanoid")
local AnimCore = Hum and Hum:FindFirstChildOfClass("Animator")
local Camera = workspace.CurrentCamera
if not (Tor and Hum and AnimCore and Camera) then return end
local CameraCFrame = Camera.CFrame
local Forward = (CameraCFrame.LookVector * Vector3.new(1, 0, 1)).Unit
local Right = (CameraCFrame.RightVector * Vector3.new(1, 0, 1)).Unit
local Facing = (Tor.CFrame.LookVector * Vector3.new(1, 0, 1)).Unit
local isShiftLocked = Facing:Dot(Forward) > 0.95
local direction = Vector3.zero
if UIS:IsKeyDown(Enum.KeyCode.W) then direction += Forward end
if UIS:IsKeyDown(Enum.KeyCode.S) then direction -= Forward end
if UIS:IsKeyDown(Enum.KeyCode.A) then direction -= Right end
if UIS:IsKeyDown(Enum.KeyCode.D) then direction += Right end
if direction.Magnitude > 0 then
direction = direction.Unit
local function Dash(directionVector, animation)
local anim = AnimCore:LoadAnimation(animation)
anim:Play()
SFX:Play3D(2769872789, Tor.Position, {MaxDistance = 100, MinDistance = 20})
local Bv = Instance.new("BodyVelocity")
Bv.P = 1250
Bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
Bv.Velocity = directionVector * 100
Bv.Parent = Tor
Debris:AddItem(Bv, 0.1)
end
local animToUse
-- Diagonals
if UIS:IsKeyDown(Enum.KeyCode.W) and UIS:IsKeyDown(Enum.KeyCode.A) then
animToUse = script:WaitForChild("DashW")
elseif UIS:IsKeyDown(Enum.KeyCode.W) and UIS:IsKeyDown(Enum.KeyCode.D) then
animToUse = script:WaitForChild("DashW")
elseif UIS:IsKeyDown(Enum.KeyCode.S) and UIS:IsKeyDown(Enum.KeyCode.A) then
animToUse = script:WaitForChild("DashS")
elseif UIS:IsKeyDown(Enum.KeyCode.S) and UIS:IsKeyDown(Enum.KeyCode.D) then
animToUse = script:WaitForChild("DashS")
-- Normals
elseif UIS:IsKeyDown(Enum.KeyCode.W) then
animToUse = script:WaitForChild("DashW")
elseif UIS:IsKeyDown(Enum.KeyCode.S) then
animToUse = isShiftLocked and script:WaitForChild("DashS") or script:WaitForChild("DashW")
elseif UIS:IsKeyDown(Enum.KeyCode.A) then
animToUse = isShiftLocked and script:WaitForChild("DashA") or script:WaitForChild("DashW")
elseif UIS:IsKeyDown(Enum.KeyCode.D) then
animToUse = isShiftLocked and script:WaitForChild("DashD") or script:WaitForChild("DashW")
end
Dash(direction, animToUse)
end
end
function GlobalKeybinds:OnLetGo(Player)
print("Client: dashy quicky")
end
return GlobalKeybinds
your conditions probably wrong
-- Diagonals
if UIS:IsKeyDown(Enum.KeyCode.W) and UIS:IsKeyDown(Enum.KeyCode.A) then
animToUse = script:WaitForChild("DashW")
elseif UIS:IsKeyDown(Enum.KeyCode.W) and UIS:IsKeyDown(Enum.KeyCode.D) then
animToUse = script:WaitForChild("DashW")
elseif UIS:IsKeyDown(Enum.KeyCode.S) and UIS:IsKeyDown(Enum.KeyCode.A) then
animToUse = script:WaitForChild("DashS")
elseif UIS:IsKeyDown(Enum.KeyCode.S) and UIS:IsKeyDown(Enum.KeyCode.D) then
animToUse = script:WaitForChild("DashS")
-- Normals
elseif UIS:IsKeyDown(Enum.KeyCode.W) then
animToUse = script:WaitForChild("DashW")
elseif UIS:IsKeyDown(Enum.KeyCode.S) then
animToUse = isShiftLocked and script:WaitForChild("DashS") or script:WaitForChild("DashW")
elseif UIS:IsKeyDown(Enum.KeyCode.A) then
animToUse = isShiftLocked and script:WaitForChild("DashA") or script:WaitForChild("DashW")
elseif UIS:IsKeyDown(Enum.KeyCode.D) then
animToUse = isShiftLocked and script:WaitForChild("DashD") or script:WaitForChild("DashW")
end
setting aside bodyvelocity is deprecated, i dont see any definition for directionvector in here Bv.Velocity = directionVector * 100 i think its meant to be direction?
most of this code looks fine except that one line, i suspect there may be errors. be sure to check your output window for errors
with the directionvector replaced
i was pressing w+a+q and s+a+q
both shiftlock and not shiftlock
output window only shows errors after they occur not before ;p
but i'm going to assume no errors, at that point time to start adding prints to check what is and is not executing
output was still clean i promise
** You are now Level 3! **