This is honestly a stupid question but I do want to learn and this will not be my last post. I am utilizing the whole AI scripting thing to get a rough script and no surprise it doesn’t work. Hehe. How would I get this to work, this is supposed to be a tank and all setup to function (Unless I did something wrong) but I want to make it to where it functions realistically where A would to be traverse left and D to traverse right but to go straight I want A and D pressed at the same time and so this is what I have so far
local L1 = script.Parent.left1.RoadwheelConstraint
local L2 = script.Parent.left2.RoadwheelConstraint
local L3 = script.Parent.left3.RoadwheelConstraint
local L4 = script.Parent.left4.RoadwheelConstraint
local R1 = script.Parent.right1.RoadwheelConstraint
local R2 = script.Parent.right2.RoadwheelConstraint
local R3 = script.Parent.right3.RoadwheelConstraint
local r4 = script.Parent.right4.RoadwheelConstraint
local speed = 60
find the player and allow the use of the keyboard, camera should be locked to first person
seat.ChildAdded:Connect(function(child)
if child:IsA("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(child.Parent)
player.Character.HumanoidRootPart.Anchored = true
player.CameraMode = Enum.CameraMode.LockFirstPerson
-- allow the use of the keyboard
player:GetMouse().KeyDown:Connect(function(key)
-- when pressing a, L1, L2, L3, L4 will spin at 60 speed positive
if key == "a" then
L1.TargetAngularVelocity = Vector3.new(0, 60, 0)
L2.TargetAngularVelocity = Vector3.new(0, 60, 0)
L3.TargetAngularVelocity = Vector3.new(0, 60, 0)
L4.TargetAngularVelocity = Vector3.new(0, 60, 0)
R1.TargetAngularVelocity = Vector3.new(0, -60, 0)
R2.TargetAngularVelocity = Vector3.new(0, -60, 0)
R3.TargetAngularVelocity = Vector3.new(0, -60, 0)
R4.TargetAngularVelocity = Vector3.new(0, -60, 0)
end
-- when pressing d R1,R2,R3,R4 will spin at -60 speed negative
if key == "d" then
L1.TargetAngularVelocity = Vector3.new(0, -60, 0)
L2.TargetAngularVelocity = Vector3.new(0, -60, 0)
L3.TargetAngularVelocity = Vector3.new(0, -60, 0)
L4.TargetAngularVelocity = Vector3.new(0, -60, 0)
R1.TargetAngularVelocity = Vector3.new(0, 60, 0)
R2.TargetAngularVelocity = Vector3.new(0, 60, 0)
R3.TargetAngularVelocity = Vector3.new(0, 60, 0)
R4.TargetAngularVelocity = Vector3.new(0, 60, 0)
end
end)
end
end)
What exactly am I doing wrong here and what can I change, how would you approach my situation? If you need more details, I will provide. I am still a beginner scripter trying different things and I know majority of the basics.