So here I have a server script inside a machine, but for some reason the machine is not behaving properly. You can check it yourself by downloading the machine file (attached below). Also below is the script.
Please help me to understand what I wrote wrong.
local seat = script.Parent.VehicleSeat
local backLeft = script.Parent.BackLeft
local backRight = script.Parent.BackRight
local frontLeft = script.Parent.FrontLeft
local frontRight = script.Parent.FrontRight
local steerAngle = 30
local speed = 60
seat:GetPropertyChangedSignal("Steer"):Connect(function()
frontLeft.PartB.SteeringConstraint.TargetAngle = steerAngle * seat.Steer
frontRight.PartB.SteeringConstraint.TargetAngle = steerAngle * seat.Steer
print("Left: ".. frontLeft.PartB.SteeringConstraint.TargetAngle, "Current Right: ".. frontRight.PartB.SteeringConstraint.TargetAngle)
end)
seat:GetPropertyChangedSignal("Throttle"):Connect(function()
frontLeft.Wheel.WheelConstraint.AngularVelocity = speed * seat.Throttle
frontRight.Wheel.WheelConstraint.AngularVelocity = speed * seat.Throttle
backLeft.Wheel.WheelConstraint.AngularVelocity = speed * seat.Throttle
backRight.Wheel.WheelConstraint.AngularVelocity = -speed * seat.Throttle
end)
Car4.rbxm (10.1 KB)