Hello! I am making a car rig, however, I don’t know the most efficient way to turn it when S and D are pressed.
Here is what I have so far:
local function Left(ActionName: string, UserInputState)
if UserInputState == Enum.UserInputState.Begin then
Kart.Tires.FL.Attachment1.Orientation = Vector3.new(0, -160, 0)
Kart.Tires.FR.Attachment1.Orientation = Vector3.new(0, 160, 0)
else
Kart.Tires.FL.Attachment1.Orientation = Vector3.new(0, 0, 0)
Kart.Tires.FR.Attachment1.Orientation = Vector3.new(0, 180, 0)
end
end
local function Right(ActionName: string, UserInputState)
if UserInputState == Enum.UserInputState.Begin then
Kart.Tires.FL.Attachment1.Orientation = Vector3.new(0, 160, 0)
Kart.Tires.FR.Attachment1.Orientation = Vector3.new(0, 160, 0)
else
Kart.Tires.FL.Attachment1.Orientation = Vector3.new(0, 0, 0)
Kart.Tires.FR.Attachment1.Orientation = Vector3.new(0, 180, 0)
end
end
ContextActionService:BindAction("Forward", Forward, false, Enum.KeyCode.W)
ContextActionService:BindAction("Backwards", Backwards, false, Enum.KeyCode.S)
ContextActionService:BindAction("Left", Left, false, Enum.KeyCode.A)
ContextActionService:BindAction("Right", Right, false, Enum.KeyCode.D)
Here is what this code is currently doing:
Please let me know how to fix.
Thanks, Bill