I know that this has been done before. Most of those are confusing and/or don’t work anymore (thanks, Roblox!)
I’m trying to achieve an effect like DOORS where when the player presses the A and D keys (I know UserInputService could help that factor) the player’s legs face either left or right accordingly. A post a while back by @Moonmonger was answered and worked for a while, but in recent testing, I’ve noticed it causes the player’s legs to face different directions. So, how can I achieve this effect?
local userInputs = UserInputService
local leftLeg = script.Parent:FindFirstChild("Left Leg")
local rightLeg = script.Parent:FindFirstChild("Right Leg")
local function onKeyDown(key)
if key.KeyCode == Enum.KeyCode.A then
-- Rotate left leg inwards, right leg outwards
elseif key.KeyCode == Enum.KeyCode.D then
-- Rotate left leg outwards, right leg inwards
end
end
userInputs.InputBegan:Connect(onKeyDown)