I’m making a spinoff of Quaternions’ surf and bhop games, and I’m making different styles just like in those games. My backwards movement style still allows for forward strafing, and I don’t want it to do that.
--variables defined earlier in the script--
local forward = Vector3.new(camCF.LookVector.X, 0, camCF.LookVector.Z).Unit
local right = Vector3.new(camCF.RightVector.X, 0, cam.CFrame.RightVector.Z).Unit
local wishDir = Vector3.new(0, 0, 0)
local moveKeys = {
W = false,
A = false,
S = false,
D = false
}
UserInputService.InputBegan:Connect(function(input, processed)
if processed then return end
if input.KeyCode == Enum.KeyCode.W then moveKeys.W = true end
if input.KeyCode == Enum.KeyCode.A then moveKeys.A = true end
if input.KeyCode == Enum.KeyCode.S then moveKeys.S = true end
if input.KeyCode == Enum.KeyCode.D then moveKeys.D = true end
end)
--actual code block--
elseif movementValue.Value == "Backwards" then
if moveKeys.W then wishDir = wishDir + forward end
if moveKeys.S then wishDir = wishDir - forward end
if moveKeys.A then wishDir = wishDir + right end
if moveKeys.D then wishDir = wishDir - right end