Hello there! I’ve been trying to build and code a swivel chair that you can drive like a car. There’s just one minor problem that makes it not function. I’ll go into detail on this.
This is my swivel chair model before the game starts. It is composed in multiple parts:
- The VehicleSeat at the top, welded to
- The “Swivel”, the half of the rod that sticks up into the seat. It is noncancollideable. It has a motor HingeConstraint with the bottom half, which is called the
- Base, which is welded to each of the
- Legs, which have no use except to make the chair look like a swivel chair. They are also noncancollideable.
- The motors are the invisible parts highlighted. They have a Motor HingeConstraint in them attached to the
- Wheels, which have a motor HingeConstraint attached to them and the
- Drivers. The drivers are exact copies of the wheels, except noncancollideable and transparent, and only serve to help turn the wheels.
All the wheels are rotated 0, 0, 0.
All the hinges are Motor because I want them all to be able to go at any angle.
So what’s the problem?
Look back at the swivel chair model. This is before the game starts.
And after the game starts running.
Which completely disables it from moving. How would I prevent this from happening? What should I put in place to make sure it stays upright like in the first picture? The code is most likely correct, because although the wheels don’t turn, the swivel part of the chair does. All help would be appreciated.
Here is the code, by the way.
(chair being the model everything is contained in)
local vs = script.Parent.VehicleSeat
local b = chair.WheelBack
local f = chair.WheelFront
local l = chair.WheelLeft
local r = chair.WheelRight
local swivel = chair.Swivel
local base = chair.Base
vs:GetPropertyChangedSignal("Steer"):Connect(function()
base.SwivelConstraint.AngularVelocity = 30 * vs.Steer
b.Motor.WheelConstraint.AngularVelocity = 30 * vs.Steer
f.Motor.WheelConstraint.AngularVelocity = 30 * vs.Steer
r.Motor.WheelConstraint.AngularVelocity = 30 * vs.Steer
l.Motor.WheelConstraint.AngularVelocity = 30 * vs.Steer
end)
vs:GetPropertyChangedSignal("Throttle"):Connect(function()
b.Driver.DriverConstraint.AngularVelocity = 60 * vs.Throttle
l.Driver.DriverConstraint.AngularVelocity = 60 * vs.Throttle
r.Driver.DriverConstraint.AngularVelocity = 60 * vs.Throttle
l.Driver.DriverConstraint.AngularVelocity = 60 * vs.Throttle
end)```