Hello there! I am currently making a climbing system and are in need of a feature which makes the player rotate based on which direction they are moving in.
You can have a look at my current system here: https://gyazo.com/a5ad106d42ee3831837c9b116fff8d91
The player is only looking in one direction, how could I rotate them when they are moving up/down
Heres the foremost code im using to change the body velocity and body gyro:
local controls = {0, 0, 0, 0}
local keys = {"A";"D";"W";"S"}
UIS.InputBegan:Connect(function(key, isChat)
local button = table.find(keys, key.KeyCode.Name)
if button and not isChat then
controls[button] = 1
end
end)
UIS.InputEnded:Connect(function(key)
local button = table.find(keys, key.KeyCode.Name)
if button then
controls[button] = 0
end
end)
-- loop
local movement = hrp.CFrame:VectorToWorldSpace(Vector3.new(controls[2] - controls[1], controls[3] - controls[4], 0)) * 20
Utilities.setVelocity(movement)